ni.com is currently experiencing unexpected issues.
Some services may be unavailable at this time.
12-17-2012 04:52 AM
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
12-17-2012 08:03 AM
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.
12-17-2012 09:01 AM
like this ?