Solved

Visual C++ - Edit Box & variable precision

Posted on 1997-06-21
1
257 Views
Last Modified: 2012-05-04
In Visual C++ 4.0, I have created 4 edit boxes and placed
 them on a dialog box. I have assigned a floating point
variable to each edit box. Next to each box I have a radio
button. By checking the radio button for one of the edit
 boxes, the relevant edit box will become disabled.
By changing the values of the other three edit boxes the
disabled box's value will change. The problem is how do
I change the amount of decimal places displayed in the
disabled edit box. I would also like to change the color
of the result if it goes out of range.
0
Comment
Question by:robvg
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 1164015
You can convert a floating point variable to a string by using ::_ecvt(), ::_fcvt(), ::_gcvt(), ::wsprintf() with which you can determine the precision you want. In order to change the color of the edit box, you need to process WM_CTLCOLOR in your own edit box class or ON_WM_CTLCOLOR_REFLECT() in your own dialog class. See MFC Technical Notes: TN062: Message Reflection for Windows Controls.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now