LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

disabled Slider is enabled

I have a large problem disabling a slider in my application. Here is my minimal example:

 

I have a simple Slider, which is disabled and grayed out if the value is higher than 5. Otherwise the Slider is enabled.

 

Slider.PNG

 

If I drag the slider higher than 5, the Slider gets grayed out. But I am still able to move the slider around and change the value. Only after I dropped the Slider, the Slider is disabled to use.

 

In my opinion, this is a large bug of LabVIEW. Is there any way to disable the Slider correct during drag?

 

Thank you for your answers!

0 Kudos
Message 1 of 10
(4,831 Views)

The Behaviour you observe is not a bug

 

The actual Value of the control does not change until you realese the control therefore the test is it greater than 5 is only true when you release the control.

 

You can obtain the behaviour you want with an event structure and using the event Mouse move on your slider then the value will be disabled but it will continue to update its value because the movement started when it was authorised.

 

I think you need to think about what you want to do. If you don't want the user to enter a value greater than 5 then why don't you limit the scale of your slider to 5.

 

The problem you will face if you could do what you want is that the slider will be stuck to a value greater than 5 then it can never be unstuck.

0 Kudos
Message 2 of 10
(4,809 Views)

Thank you for your answer!

 

I am running this code in a loop. And the value is changing without releasing the control. I know this, because the Silder gets grayed out if I I am higher than 5.So my actual value is changing during movement.

 

Why is my Slider grayed out and I still can move them until release them? - It should be disabled!

 

This is only a minimal example. Unfortunately don't have the opinion to scale my slider only until 5.

0 Kudos
Message 3 of 10
(4,793 Views)

In my opinion, the slider becoming grey and disabled while I am moving would upset me.

 

As I said you should rethink the way you use the disable function because of an ease of use problem

 

Can you explain exactly why you want the slider to become grey and disable?

 

0 Kudos
Message 4 of 10
(4,788 Views)

Can you explain exactly why you want the slider to become grey and disable?

 

It would be great to know this. If you don't want someone to cross a value X (in this case 5) you can limit the slider, as Didje007 mentioned. If for some reason you don't want to do that, you can just force a particular value once a threshold is reached:

 

snip.png

0 Kudos
Message 5 of 10
(4,772 Views)

This appears to be strange behavior as the Value Change event is triggered while the mouse button is held down even when the control is Disabled & Grayed Out. Running this in an event structure on the Value Change event does Disable & Grey Out but provided you keep the mouse button pressed you are still able to move the slider. Using the Mouse Move event provides the same behavior although it does look like this is triggered before the value updates.

 

One way I can think of to limit the value would be to update the Data Entry Limits Maximum property for this control and setting the Response to Value Outside Limits for Maximum to be Coerce.

 

slider.png

 

Again the question has to be asked, What exactly is trying to be achieved?

Steve Swindley (CLA since Feb 2008)
0 Kudos
Message 6 of 10
(4,747 Views)

Can you explain exactly why you want the slider to become grey and disable?

 

Like I said, the snippet is only my minimal example. In my application the following is happening:

 

I have s statemachine with a state that enables the Slider and a state that disables my Slider. The state can change every moment, so it´s possible, the user is using the slider at the moment of statechange --> moment of disabling. At this moment the slider should be disabled (it only gets grayed out) directly ... not after releasing it. So limiting the maximum is not the only target. I want to prohibit all slider actions for a user.

0 Kudos
Message 7 of 10
(4,723 Views)

It almost seems to me that value change is not really the trigger.  Maybe your enable/disable should be based on when it is appropriate to have it enabled or disabled, and not by the value.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 8 of 10
(4,700 Views)

I did not figure out how to remove focus from slider using LabVIEW tools.

You can generate Mouse Up event using User32 call

https://decibel.ni.com/content/docs/DOC-36012

Message 9 of 10
(4,691 Views)

Here's a snippet showing the use of Simulate Mouse.vi as Alexander suggests:

 

mouseup.png

 

Note that the Simulate Mouse vi has one input marked as 'Required' that doesn't need to be, so I fixed that before creating the above code.

 

I do think this is a UI technique to be used with great caution, as it could be frustrating and annoying if users don't understand why it has happened. And I don't think it's a bug in LabVIEW, because the opposite behaviour could be equally undesired in a different situation.

0 Kudos
Message 10 of 10
(4,645 Views)