LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I trigger a non-user event?

Hi,

I am wondering how I can trigger a non-user event. Basically, what I want to do is this; "force" a button press on the front panel during initialization so that I can have that event handler execute. I don't want to have to duplicate code, so this seems the best way. The other things I can think of are:

1. Create a user event and have that event handler handle the user event
2. Set the value of the button to "TRUE" in the initialization routine

#2 didn't seem to work. I'd prefer a more elegant solution than #1. Ideas would be appreciated!

Thanks,

Jason Bold
0 Kudos
Message 1 of 5
(2,604 Views)
To trigger an event as if a control has been operated, you need to write to a signaling property of that control. Create a property node and select "Value(Signaling)". Whenever you write a value to it (even if it is the existing value!), the event triggers.

(Note that writing to a local variable or a plain "Value" property does NOT trigger an event.)

Value(Signaling) is not available in LabVIEW 6.1. You need version 7.0 or newer.

Message Edited by altenbach on 03-07-2005 08:28 AM

Message 2 of 5
(2,599 Views)
Thanks - this works great for setting the sample rate with a ring command. However, something strange occurred. In my main program, I did not get an error, but I also didn't get an event. When I tried to construct a smaller program to test it, I got this error:

Error 1193 occurred at Property Node (arg 1) in Event Test.vi
Possible reason(s):
LabVIEW: When a Boolean control has a latch mechanical action, you cannot use the Value property to read or write its value.

Strange that my main program didn't generate this because the button is definitely "Latch when pressed".

Any ideas?

Thanks,

Jason
0 Kudos
Message 3 of 5
(2,585 Views)
Yes, I would not use latch in this case (I don't know why the error did not show in your main VI).

Set the boolean control to switch action, then inside the event use the "old value" event terminal and wire it to a local variable of the control to get a latch-like action.
Message 4 of 5
(2,571 Views)
The explanation is simple - the lack of the error (and the event) is due to the fact that the code was not executed. The other option is that the code did execute but you wired an error out of the property node, so you didn't get a message. In any case, the event won't execute if you have a latch action.

___________________
Try to take over the world!
Message 5 of 5
(2,567 Views)