Floats and UpDown Controls
I'm trying to get some kind of windows control that will allow me to increment in fractions (floats). I tried trackbars but had no joy.
Second attempt was to use updown boxes. The UD_ACCEL structure:
typedef struct {
UINT nSec;
UINT nInc;
} UDACCEL, *LPUDACCEL;
expects an integer. I tried creating my own custom structure
typedef struct {
UINT nSec;
float nInc;
} UDACCEL2, *LPUDACCEL2;
The compiler accepts it, but when I execute the app it increments with a strange value before crashing.
Anyone know how I can increment in decimals (0.5) rather than ints or suggest a control that will allow me to do so.
Thanks
Convert the value to a float and divide it by some value before using it. For example if you want to increment by fourths, just imagine that the control is setting the number of fourths, then convert it into the actual units. 11 fourths = 11/4 = 2.75, like that.
I am not sure this a control like this, but you could always just convert the integer into a float. If you wanted the values to be between 1.0f and 0.0f, you could just devide your integer by the maximum value.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement