Sign in to follow this  

Floats and UpDown Controls

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this