LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick question about latching boolean and event structures

Solved!
Go to solution

I hate it when that happens:  

So you read the help file carefully, Then you post some stuff depending on a statement like "This property only uses the True to False and False to True states when you set the Boolean control to latch or switch when released." 

 

Then you whip out an example like so;

Capture.PNG

And you find the dratted Help File is WRONG!

LUR only uses 2 colors and strings!

 

I really hate thatSmiley Mad

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 21 of 23
(985 Views)

@aputman wrote:

Your explanation doesn't make sense to me.  Latching, when talking about boolean controls, is the clearing of the boolean.  So when you say "Press boolean....it latches", the boolean should be cleared.  There is something else going on in the OP's code because latched when pressed should work.  Maybe there is a local variable being used to NOT the boolean after it has already been cleared.  Unfortunately, no code has yet been shown to find out what the real problem is.  

I think that I probably used the terms slightly wrong.  Actually, the latching is the change of the boolean (in this example from false to true).  The "release" of the latch is when it is read and is the "clearing" as you use.

 

So, the boolean goes from false to true when pressed and latches (latching just means it will stay true after the mouse up event)

The event fires

the boolean is released by being read

the boolean does not change state since the mouse is still down

the mouse is released

The boolean is not cleared since the latch is never read.

LabVIEW ChampionLabVIEW Channel Wires

0 Kudos
Message 22 of 23
(977 Views)

What you describe is the "Latch Until Released" action.  "Latch When Pressed" should go from False-True and back True-False and not care in the least about the Mouse Up event.  Latch When Released does the False-True-False transition and doesn't care about the mouse down event, except to trigger the searching for the mouse up.  "Latch Until Released" monitors both the mouse down and the mouse up.  

 

OP was originally using Latch When Pressed.  This should change the value to true, read it and immediately reset the boolean, regardless if the mouse went up or not.  If the boolean is not reset, something else is changing the value of the boolean, or the control is not present in the value change event to be read.  

latch.png

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 23 of 23
(968 Views)