LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a slider from making big jumps when you click in the colored indicator area.

Solved!
Go to solution

So we use sliders for controlling RF power but it could be anything. One of the problems that we have is that when someone clicks in the colored bar on a slider the slider will jump to that value.  Not usually a problem when turning things down but it can be exciting when you suddenly go to maximum power by clicking near the top of the slider. 

 

I have written a SubVI to intercept the requested slider value and make a correction by only allowing it to move in that direction by an amount which is also an input to the program.  Then I use a local to set the front panel control to the current value plus the desired delta value.

 

The question is: "Is there something that I am missing which disables the slider from moving except for when you grab and the actual control point?"

0 Kudos
Message 1 of 6
(2,303 Views)

A mouse-down (filter) event comes to mind.

 

Maybe something like:

mouse down? >> calc new value / old value delta >> exceeds threshold? >> discard = TRUE

 

to start with.  Will have to be careful when the event is discarded since the value history will be interrupted and might not be valid on the next click.

 

The only other approach I can think of would be to use the same mouse-down (filter) and perform a check that determines a mouse-down on the slider itself vs. the slider fill.  This may be possible by using indicator boundaries if you can obtain a reference to the internal slider object (may require VI scripting to be enabled).

0 Kudos
Message 2 of 6
(2,274 Views)
Solution
Accepted by topic author Tom_Powers

Scratch that, this is better:

 

Customize the slider (right click >> advanced >> customize).  Click the wrench.  Set slider pointer object all the way to the front-most layer.  Place a flat decoration to cover the slider fill, set decoration all the way to front, then move decoration back a single layer.  Set decoration to transparent.  Un-click wrench and save the control.

 

You should now only be able to adjust the value of the slider while dragging the pointer.  All clicks on the fill will be blocked by the transparent decoration.

Message 3 of 6
(2,260 Views)

You can decouple the slider value from the code value. Example:

 

https://forums.ni.com/t5/LabVIEW/Slow-down-the-impact-in-labview/m-p/4004590#M1144314

 

0 Kudos
Message 4 of 6
(2,256 Views)

It would be equally easy to limit the rate linearly. I think I posted before, but cannot search well (by phone).

0 Kudos
Message 5 of 6
(2,249 Views)

Son of a gun it worked!   Thank you playerem1  ! ! !

 

One minor change to the procedure.  I had to figure out how to move things around layer wise.  I did not find the menu item but cntl-shift-k moves things to the front and cntl-shift-j moves them to the back.  The item is right hand most dropdown up where the arrange items are. 

 

This works especially well as I am using the control as a strict type def so I only have to do it once.

 

I think a better order is. 

 

Right click -> Advanced -> Customize

Insure that the pointer is larger than the color indicator on the slider.

Right click the wrench.

Place a vertical smooth box from the decorations menu over the slider

Use the tools pallet to set the color of the box to transparent.

Select on the pointer.

Type cntl-shift-k to bring it to the front.

Save as a new control.  If you do it as a strict type def then it will stay the same and be usable everywhere that you need within the given project.

 

Message 6 of 6
(2,232 Views)