Solved

Visual C++ - Edit Box & variable precision

Posted on 1997-06-21
1
287 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 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.

689 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