?
Solved

Visual C++ - Edit Box & variable precision

Posted on 1997-06-21
1
Medium Priority
?
295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 200 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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…
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.
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

752 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