LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview slider event handling problems

Hi,
I've faced problems while working with sliders, which values are passed to serial device. I am using events, and here is a problem: if i use "Value changed" event and change slider position by moving a mouse, the event is generated a few times (i.e. event is triggered by every single value on a slider). It means, that I have to transmit intermediate values to my serial device in order to set the last one. I tried to change event "Value changed" to "Mouse Up", but there was another problem: the value doesn't change if mouse leaves control element area (i.e., "mouse up" is generated as VI event, not as slider event). It would seem to be OK, but slider position is already changed, and there is no other variable which stores
value of current slider position! I mean that value and slider position are different and I don't know how to synchronize them. Using "Mouse Up" event for whole VI is not a good solution for me, because I have multiple sliders to control separately.
How to create non-redudand and efficient slider handling? Any ideas?
(Please see attached VI example)
Thank You

Vitalijus
0 Kudos
Message 1 of 3
(3,068 Views)
You need a 2 states machine. First state waits for "Value Changed". Once a change is detected, you know that the user is editing the slider and the mouse is currently used to move the slider. Second state waits for "Mouse Up" to latch the actual value of the slider.

See http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RNAME=ViewQuestion&HOID=50650000000800000046670000&ECategory=LabVIEW.LabVIEW+General

where I gave an example not using the event structure but a picture control to detect mouse up and a shift register to detect changed values.


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 3
(3,065 Views)
Take a look at this thread:

Labview slider event handling problems - revisited

for a potential solution.
0 Kudos
Message 3 of 3
(2,986 Views)