HomeProductsCookbookPhotosProgrammingAdminKBBrewLinksSearch

CFloatEdit

Inherits from CEdit

The CFloatEdit class provides an edit control that automatically evaluates fractions & simple math expressions and converts them into their decimal equivalents.  CFloatEdit is extremely simple to use; once you have used ClassWizard to create a CEdit member variable for one of your dialog controls, just edit the generated header code & replace CEdit with CFloatEdit in the instantiation code (you also have to include floatedit.h).

At runtime, the user enters text into the control and when the control loses focus (ie: the user presses TAB), the text is evaluated & replaced with the decimal equivalent.  The following are examples of legal expressions:
 

    5/32
    3  5/32            This is three and five thirty-seconds
    1/2 + 1/4
    3 * 4
    1/4  /  1/32
    5  -  1/32
    1.25 + 3/5
    3/5 * 1.75
     

The main restriction is that the operands and operators (+-*/) must be space separated.  Also, integer and fractional parts must be space separated.

There is no need to call any member functions for this class, so I won't bother to describe them here.  If you feel the urge, however, explore them at will...
 

#include <FloatEdit.h>
 

Dependencies

None.
 


[.cpp][.h]



Please send any comments or suggestions to grimmd@oocities.com