LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Limit range of one slider to the other slider's value on a two-slider pointer slide control

I wish to have two sliders, a lower and upper.  The lower should not be able to go beyond the upper's value and the upper should not be able to go less than the lower's value.
 
I've tried in the slider's Value change event to check the slider's values.  If the lower slide value is greater than the upper, the upper value is written back to the lower value.  If the upper slide value is less than the lower, the lower value is written back to the upper value .  This works for one slider, but the other ends up being able to "push" the second slider to the control limit.

Is it possible to restrict the data range for individual sliders on a pointer numeric slide control ?  The Data Range property seems to apply to the entire control.  It is applied to all sliders. 

There is an ActiveSlider property and it can be written to, but then changes made to the Data Range minimum or maximum properties do not effect that specified ActveSlider.  They effect all sliders.

 
0 Kudos
Message 1 of 13
(11,458 Views)
Here's a suggestion:
Try reading the ActiveSlider property and use the value of the other slider to set the minimum or maximum range for the active one. I assume that the sliders are set (one is the high one and one is the low) because otherwise, if they meet, they will get stuck.

___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(11,453 Views)
I wanted to test it, so here's an example (7.0)

___________________
Try to take over the world!
Message 3 of 13
(11,447 Views)
This approach works for what I need.  It can be extended to add a third slider that is restricted to between the lower and upper limits.  Thanks
 
0 Kudos
Message 4 of 13
(11,428 Views)

I'm trying to add a third slide on the control so that the middle slide has it's max limit set by the upper slide and it's lower limit set by the lower slide.  Any suggestions?

 

Thanks,

 

Steve....

0 Kudos
Message 5 of 13
(11,263 Views)

OK, this is a very old thread and many things have changed since then.

  • In the simplest case, you can just add a bit more logic for the third slider and expand on the above example by tst. Should be trivial. Have you tried?
  • If you have LabVIEW 8.0 or higher, you could wrap the entire thing in an Xcontrol. This has the advantage that there will be no visible code on the diagram and the limits are even enforced if you change the sliders in edit mode. 😄
  • Maybe you don't need any of this. You could just have a control with three sliders, then sort the three outputs before handing them off to the rest of the code (See attached, LabVIEW 7.0).
  • ...

 

0 Kudos
Message 6 of 13
(11,253 Views)

Hallo,

 

This thread might be already dead but I need a similar help:

 

Do to my task I need a scaling possibility that allowed me to set :
- a Coarse Resolution Range A to B
- and within A-B a High Resolution range C to D

Those ranges are very dynamic… therefore I’m building a GUI that will be used by the Field-Operator for adjustment…

Here in attaché my considerations with a slide control (4 Slider) but it’s not working….

 

I’m thankful for anyone who can lead me to the right direction Smiley Frustrated.

Thanks

 

Unbenannt.PNG

0 Kudos
Message 7 of 13
(9,737 Views)

Hi Serikah,

 

at first some basic math:

   IF (A == C-1) THEN C = 2C-A ELSE C = C

can be transformed to

   IF (A == C-1) THEN C = 2C-A = 2C-(C-1) = C+1 ELSE C=C

 

The other operations are similar...

 

Next problems:

- Using two property nodes in parallel to set values of a control will lead to race conditions!

- Constantly setting the value of a control will give a very bad user experience...

- Comparing floats for equality will lead to numeric accuracy problems, as has been pointed out a lot of times before in this forum! You better compare with ">=" (or "<=") instead of "=="...

- Instead of polling the slider you should use an event structure waiting for a ValueChange event...

 

- Is the user allowed to move A&B too or does he only move C&D?

- Use Min/Max function to limit movement of inner sliders...

- Use InRange function to detect "coarse" range(s)...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(9,734 Views)

Thank you GerdW

 

for the quick response and the correction.

 

To your question: “Is the user allowed to move A&B too or does he only move C&D?”
YES. He is going to set all 4 Slider.

 

I just need to make sure he never set A>C and/or B<D

My first option was with “inRange Function” as you suggest in combination with property nodes.

Bus this only works by a slide-bar containing only 2 Slider.

The property nodes “Data entry Limit” and “Scale range Limit” set the limit for the whole Slide-bar and not a Limit within a Limit.

 

Thanks

SeFe

0 Kudos
Message 9 of 13
(9,716 Views)

Hi Serikah,

 


My first option was with “inRange Function” as you suggest in combination with property nodes. Bus this only works by a slide-bar containing only 2 Slider.


 

???

Why should InRangeAndCoerce only work for a slidebar with two sliders?

You can get the current value of all 4 sliders and compare each pair of them as needed!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(9,713 Views)