LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

numeric slider increment values

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

0 Kudos
Message 1 of 3
(1,517 Views)

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.

0 Kudos
Message 2 of 3
(1,495 Views)

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:

Screenshot 2022-03-24 15.24.33.png

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(1,475 Views)