LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

executing a default event when vi is launched

Hello,
Does anyhone know of an elegant way to execute a particular event case once when launching the vi that contains it?  I can duplicate event the code and put it in front of the event case, but that doesn't seem clean.  I was browsing through "events handled by this case", and had an idea of adding "this vi" event, if there were a "launch" event  or something similar, but I dont' see one.  Any ideas?  I've run into this need a couple times now.

Thanks
0 Kudos
Message 1 of 4
(2,921 Views)
There's a couple of ways you can handle this, depending on what level of flexibility and complication you want. One way is to use dynamic events. You can then edit the events handled by your specific event case. There's a couple of examples that ship with LabVIEW that show you how to use dynamic events. A second way is to create a boolean control/indicator called "init", and then outside your event structure set the value using the "Value (signaling)" property. Then, edit your event case to also execute when the boolean's value changes.
0 Kudos
Message 2 of 4
(2,915 Views)
If the event is a value change event, you can create a property node for the control and select the Value (Signaling) property. Wire a constant to this outside the loop and the event wire fire when you start the program.
0 Kudos
Message 3 of 4
(2,912 Views)
That does the trick beautifully.  Thanks a lot guys.
0 Kudos
Message 4 of 4
(2,899 Views)