LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to disable needles on a slider?

I was wondering if there were any way to disable needles on a slider. What I have is a slider with four needles, but I need to be able to disable two of the needles programmatically. I am currently setting the needles to transparent color and setting their values to +/- inf, but the user can still accidently select and move them. While this does not cause the program to work incorrectly, it does cause some visual confusion, since I am using fill modes. Basically, I am using the slider to allow the user to select areas on a graph, the filled area between the sliders are the areas that are being measured on the graph. The extra two sliders are for when the user wants to select multiple areas for measurement, and thus are
not always in use.
Jon D
Certified LabVIEW Developer.
0 Kudos
Message 1 of 5
(4,009 Views)
You can pick the Active Slider using a property node, but I couldn't find anything to disable a slider without disabling the control.

You could have two identical slide controls on top of each other, one with two sliders, the other with four sliders. Have only one of the two slider controls visible and enabled (using property nodes) at a time.

This next way is pretty clunky, but you could try to use an event structure with a case for Mouse Down on the slide control. Check the Active Slider before the Mouse Down event. Then on the Mouse Down event, check if the Active Slider is one you want to disable. If it was, set a flag in the event case. Then (outside of the event structure), if the flag is set, restore the original Active Slider and disabled slider posit
ion.
0 Kudos
Message 2 of 5
(4,009 Views)
I really like AI S's double slider idea. I've attached a little VI, MyThilt, which demonstrates how to do this. I hope it helps.
J.R. Allen
0 Kudos
Message 3 of 5
(4,009 Views)
I had originally considered using a double slider approach, but the slider is part of a cluster which is referenced in several places throughout the VI and its subVI's, so I was looking for something a bit easier. I tried turning off fill mode for the two invisible needles, but the other two needles still fill up to them, giving me the strange images, alas.
Jon D
Certified LabVIEW Developer.
0 Kudos
Message 4 of 5
(4,009 Views)

Just ran into this issue with an application.  Solution attached. 

 

Use the Value Changed Event and set the current value of the slider to the previous value.  Some display artifacts occur as the UI thread is executed, but the subVI prevents the user from changing the value of a slider.

 

-Adam

Download All
0 Kudos
Message 5 of 5
(3,640 Views)