LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate an event in another VI?

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?

0 Kudos
Message 1 of 6
(5,095 Views)

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

0 Kudos
Message 2 of 6
(5,080 Views)

And also check this nugget from Ton, might be more appropiate for your request.

 

Felix

0 Kudos
Message 3 of 6
(5,074 Views)

global variables?

0 Kudos
Message 4 of 6
(5,046 Views)

@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. Smiley Wink

 

Felix

0 Kudos
Message 5 of 6
(5,037 Views)

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

Message 6 of 6
(4,977 Views)