LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I translate the VI Activation Event Type (a number)?

I am relatively new to LabView (8 months programming a large project). I am trying to better understand events and  how the event structure works.

 

I created a simple example VI which Adds two numbers and provides the result on the front panel. Within the While loop are two events that respond to the user clicking two buttons, Add Numbers and STOP. This VI is a SubVI called by a Top Level or parent VI.

 

Everything worked fine until I added a VI Activation event to the Event Structure in the SubVI (just to see what it did). Now when I call the SubVI, the VI Activation event is triggered and it is the first thing the subVI processes. I am calling the SubVI  inline in the TopLevel VI not with an Invoke Node. The surprising thing to me is that the VI Activation event is triggered over and over once the subVI starts, even though I am NOT doing anything interactive with the Front Panel (yet) and I only call the SubVI once. Essentially the Event Structure goes into an infinite loop. Both the Event Source and Type are numeric data types and my probes tell me that Source and Type are both set to zero when the VI Activation Event is triggered.  I can't find a list of Type numbers to know how to translate the numeric value into an event. Is there a list of Type numbers and their corresponding event?

 

I assume that zero means that nothing specific triggered the VI Activation event, but if the event type is zero, I don't understand why the VI Activation is triggered in the first place, much less repeats. There isn't much information on the VI Activation event in the Forums or NI documentation and I can't find any examples to show how VI Activation is supposed to work. From the meager information I have found, I thought the VI Activation event was triggered only when the user interacted (in some way) with the UI. Can someone provide more insight?

 

Unfortunately my company does not permit me to upload any code (I am currently signed in with my personal account), but I am including a screen capture of the block diagram.

0 Kudos
Message 1 of 4
(2,794 Views)

You are going to laugh at yourself

 

VI Activation events a triggered whenever that vi receives focus (is frontmost=True)  So as soon as you clear the modal dialog you generate the focus shifts right back to the vi and ...That's another VI Activation event right there"

 

(Don't put pop-ups in a VI Activation event!)


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(2,781 Views)

Thanks for your quick reply. The SubVI I'm calling is NOT modal, it's just a standard VI. Your point about the popup dialogs, however, is a good one. I get your point that each time I dismiss the dialog, that's another activation event.

 

I just went back and did some more debugging and tracing.I removed the dialogs, as you suggested and implemented an 'init' routine for the Case Structure. After clicking and tracing a few more times, I found that interacting with the Block Diagram window also triggered user events. The documentation isn't clear (to me) because it mentions only the Front Panel. So VI Activation works for both the Front Panel and the Block Diagram, which is not really documented. As you stated, Activation is triggered whenever the VI gets 'handled' whether it's the front panel or the block diagram. Thanks for your insight!

0 Kudos
Message 3 of 4
(2,765 Views)

Typically you don't mess with the BD while a VI is running (Unless you are the developer) and the Help file is written from a "Run-Time" perspective.  Just another thing to keep in mind- after all we want the USER to have a good experience even if the Developer shoots off a foot!Smiley Very Happy

 

Source [0] means the LabVIEW UI generated the event.  Type is less exposed


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 4
(2,759 Views)