LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean and Latch mechanical action.

Hi,

I have 2 VI's. 1 VI have a button with mechanical action - latch when released, in 2 VI i tried to press this button writting constant boolean - True to the Property node -> Value(Sgnl), but i can't do that, and i know why. My question is can I press this button in other way? I can't change his mechanical action and i am using LV 2011. I really need help 😞

 

0 Kudos
Message 1 of 9
(5,805 Views)

There are reasons (and limitations that go with those reasons) for the Latch Until Released behavior, but you can "have your cake and eat it, too".  Suppose your Latched Boolean is the Stop Control, which lives in an Event Structure.  Create another Boolean, an ordinary switch indicator, and call it "Quit".  Modify your Event Structure as follows:

  • Stop (Value Changed) -- wire it to a Quit "Value(Signaling)" Property node (thereby "passing the buck".
  • Quit (Value Changed) -- pop up the "Old Value" right-hand Data Node and wire it into Quit (effectively programmatically changing this to a Latch Until Released behavior).  Now execute (with the known "True" value passed from Stop to Quit) whatever code you were going to do when you pushed the Stop Button.

So how does this help?  Well, you can't programmatically "push" the Stop control, but you can "push" Quit -- simply drop a Value(Signaling) Property Node for Quit and wire "True" to it.  

 

Enjoy.

 

Bob Schor

Message 2 of 9
(5,781 Views)

This make sense, but when i wait for reply some idea come to me. In my VI I programmatically bring second VI on the top then I set "Key Focus" property to this boolean control to True and simulate clicking left button of mouse. This maybe is going around but it work. As soon as I have some time, I will try your way. Thanks for the reply.

0 Kudos
Message 3 of 9
(5,768 Views)

All you need is change the button to switch action. (latch action is just a built-in convenience that can always be simulated programmatically. That's what LabVIEW does behind the scenes :))) In the event structure, reset it to false using a local variable wired to the "old value" from the event data node. Now it is indistinguishable from a latch action from a user point of view. 

 

If you want more detailed help, please attach a simplified version of your code. Manyt higns are not entirely clear. Do both VIs have an event structure?

Message 4 of 9
(5,758 Views)

Another option is to use an User Event to send the message to the Event Structure.  You can have the User Event and the button's value change event handled by the same event case.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(5,745 Views)

I'm with Altenbach for the quick and simple.  Just make the control switched, then where you read the control value (hopefully in one place in the event structure that handles the value change) just use a local variable and set it back to false.  The problem I often see is new developers don't know when they should be clearing a controls value, and as a result you see local variables sprinkled everywhere on the block diagram setting and clearing control values all over the place.  Then you run into race conditions and not knowing why a control value is changing when it does.  Keep the local variables to a minimum to help avoid this confusion.  Don't read this as "You should only have 0 or 1 local variables for a control" but instead just try to use them in logical places and don't over use them.

0 Kudos
Message 6 of 9
(5,740 Views)

Altenbach and Hooovahh i can't change mechanical action because I don't have source code of VI with button.

Crossrulz can you give me some help with this User Event because I never used this before?

0 Kudos
Message 7 of 9
(5,723 Views)

@Kamilnd wrote:

...I don't have source code of VI with button.


Then there is not anything you can do.  The interface you were given is all you have.  Even User Events would require updating the other VI so read the event.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9
(5,711 Views)

Then I will stay with simulate key pressing on focused button. Thanks guys.

0 Kudos
Message 9 of 9
(5,706 Views)