ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3 way switch

Hi,

I have created a 3 way switch using slider (Top:Increment, Middle:Idle and Down:Decrement).

Requirement: when we move the slider from idle(default) to increment position (until release the mouse) the slider should be at increment position and whenever release the mouse it should coma back to idle , same process required for decrement. 

 

I have made the same using Event structure and mouse release event . Some time,Its working fine and some time its getting stuck at increment/decrement position after releasing the mouse .

 

I am not ableto  find, why its getting stuck at increment/decrement position?

I have attached the VI. Plz find the attached vi and let me know if you found some thing.

 

 

 

Thanks & Regards,

Srikant

0 Kudos
Message 1 of 3
(2,600 Views)

It does not appear you are accounting for all cases you need to worry about.  I would suggest you write a state diagram for the different states the control can be in, then detail what can cause a transition to the other states.  Note that any mouse event can occur at any value of the control, so you need to control value to determine what the current state of your control is.  Fortunately, with local variables, this is easy.  You should be able to manage this behavior with mouse leave and mouse up events only.  No need for the extra loop at the bottom.

 

Note that you can process multiple events for the same control in the same event structure (e.g. mouse up, mouse down, and value changed).  In fact, you can put them all in the same frame of the event structure, although this would not help your current problem.

 

Good luck.

0 Kudos
Message 2 of 3
(2,568 Views)

like this ?

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 3
(2,559 Views)