Solved

Visual C++ - Edit Box & variable precision

Posted on 1997-06-21
1
231 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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

771 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

12 Experts available now in Live!

Get 1:1 Help Now