02-17-2017 11:38 AM
Hey, for some reason my latched boolean controls are not resetting when using an event structure.
I have put the booleans controls in their respective events, and even tried using flat sequence structures to ensure the VI reads them.
What is a reason this could be happening? Can't post the code just at the moment.
Solved! Go to Solution.
02-17-2017 12:13 PM
Are you sure the event case is being called? Are you sure the control is set to Latch?
Those are the only reasons it would not unlatch when the terminal is in the Value Change event case.
02-17-2017 01:30 PM
If you have a Latch Until Released button tied to a while loop condition terminal that exits the program, the button likely won't unlatch before the program exits.
02-17-2017 01:42 PM
@aputman wrote:
If you have a Latch Until Released button tied to a while loop condition terminal that exits the program, the button likely won't unlatch before the program exits.
Why do you say that? My experience, the button unlatches as soon as it is read, which is going to occur before the event structure exits and then the while loop.
02-17-2017 01:57 PM
@RavensFan wrote:
@aputman wrote:
If you have a Latch Until Released button tied to a while loop condition terminal that exits the program, the button likely won't unlatch before the program exits.
Why do you say that? My experience, the button unlatches as soon as it is read, which is going to occur before the event structure exits and then the while loop.
Because it doesn't unlatch. Try it. I guess if you can click and release the mouse fast enough before the program exits, it would unlatch. But I can't run the above code and get the button to unlatch before exiting.
02-17-2017 02:05 PM
It works just fine for me.
Here is a version saved in LV2014. (I originally created it in LV16 and it worked fine there also.)
I also tried making it Latch When Pressed to see if that changed anything. It still unlatched.
02-17-2017 02:27 PM
I'm still on 2012 so I can't open your file. Latch When Pressed and Latch When Released work fine. If you look at the visual explanation of Latch Until Released, the mouse goes down, the button value is changed, the control is read and at this point the event structure is complete and the program can exit but the mouse button hasn't be released and so the control can't reset. Has something changed since 2012 in this regard?
02-17-2017 02:41 PM
This is what happens when no code is posted to explain the problem. LOL
02-17-2017 03:19 PM - edited 02-17-2017 03:22 PM
I'm sorry. You're right. Having code sure would've helped. The original poster never really did say which version of Latched he was using.
Your posts did say "Latch Until Released" and I kept thinking "Latch When Released". Why, I have never found a valid reason to ever use Latch Until Released and don't know why anyone would.
If I would rank the order of how often I used the different actions.
1 or 2 Latch When Released (bottom center)
1 or 2 Switch When Released (top center) both of these behave with normal Windows button action of allowing you to drag off before releasing in case you made a mistake.
3 Switch Until Relased (top right) used this a few times for "jog" buttons, act on when pushed in, stop immediately upon release. Usually use in conjection with an event structure.
4 or 5 Latch When Pressed (bottom left)
4 or 5 Switch When Pressed (top left) only use if I need an instantaneous action upon the press
6 Latch Until Released (bottom right) Never, ever, ever used it. No idea why I would.
But you're right, Latch Until Released does not pop up because the VI probably stops running before you let go. And a non-running VI has no latching and unlatching actions with it.
To the original poster, if you are using Latch Until Release, just don't. If you think you do, please tell us why. I would bet you are using the wrong action and really want Latch When Released.
02-18-2017 01:44 AM - edited 02-20-2017 01:20 PM
@nishalc wrote:
Hey, for some reason my latched boolean controls are not resetting when using an event structure.
I have put the booleans controls in their respective events, and even tried using flat sequence structures to ensure the VI reads them.
We cannot debug vague sentences.
As mentioned, we don't even know if the event executes. You also did not say what kind of event is assigned to the latched boolean (value changed, mouse down, etc.).
I don't understand your "use flat sequences" logic. Sequences don't ensure anything except execution order.