03-23-2022 02:42 PM
CVI 2017
I would like to use a numeric slider for the user to pick a decimal number in range 0 - 2.0. In the callback I will check the value and respond if it is a particular number. As it seems, the smallest step size that the user can move is smaller than the resolution that I am testing for. I can place the slider on exactly 0.5000 but not, for example, 0.6000... it might be 0.60321.... I would like to be able to resolve increments of 0.005 (and not smaller). I can move this step size with the up and down arrows, but I can't be sure that the user stops moving the slider at an integer multiple of 0.005.
If I could set the total steps from 0 to 2 to be 400, and the slider would only return of value of such increments, I would be one happy guy
thanks for any thoughts
03-24-2022 02:47 AM - edited 03-24-2022 02:47 AM
To have complete control, in particular is you resize the slider, and since you don't want continuity but discrete values, I think I'd use a 'pointer slide', set a 'double' data type and assign the numerical values I want and an sprintf("%.1f") of the value in the label pair.
03-24-2022 09:32 AM
I seem to understand that gdargaud is suggesting to use a ring slide control, that indeed seems the one that better fits your needs. Unfortunately, you cannot hide some items in a ring control, so the resulting ring will be very large if you want to display all your 401 steps (0 included).
As a comparison, these are a 0-to-2.0 numeric slide compared to a 0-to-0.1 ring:
What I can suggest is to use a numeric slide and post process the value enterd by the operator: in the commit event callback you can read control value, confine it to the desired 0.005 step, put the resulting value back to the control and finally process it as required.