10-11-2010 01:52 PM
Hi, I'm trying to create a VI which should be able to generate events in another VI. The other VI has several boolean buttons placed inside an event handler. I want my VI to be able to press a button in the other VI and retreive the results of the event, which will be in the form of a string or a ring.
Is this possible?
10-11-2010 02:35 PM
Look at user events. With these, you can send a string or an enum (not a ring! A ring is just for UI! always use a type def'ed enum for code).
In addition, if you have a reference to the boolean in the vi, you can trigger events with the value(signaling) property. By I recommend using User Events.
For more on this, you can check out this nugget of mine.There are some really cool other threads on user event in this forum and in the breakpoint forum, I just don't have them navigable.
Felix
10-11-2010 02:44 PM
10-11-2010 05:06 PM
global variables?
10-11-2010 06:16 PM
@Scott: No. Never.
The only globals you should ever have oin your code are WORM (write once, read many). They seem so simple to use, but they bite you back.
Apart from that, you would need polling instead of using the elgant asycronous mechanism of events.
If you want to learn why the strict 'No' on globals come from, just look at the 'why local variables are bad thread' for thousands of examples of code that didn't work just because of a usage of locals (and globals are the more powerful evil).
But: don't take this personal. Your help is appreciated.
Felix
10-14-2010 02:24 AM
There is an easier way still 🙂
if you manage to get a control reference into the VI, you can invoke a control event with the property node value(signaling). It wil invoke a value change event in the VI that owns the control.
Aart-Jan