07-25-2017 06:30 AM
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 😞
07-25-2017 07:19 AM
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:
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
07-25-2017 08:22 AM
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.
07-25-2017 09:08 AM
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?
07-25-2017 09:57 AM
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.
07-25-2017 10:19 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-26-2017 01:35 AM
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?
07-26-2017 03:59 AM
@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.
07-26-2017 05:21 AM
Then I will stay with simulate key pressing on focused button. Thanks guys.