From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub-panel Events

Hello,

 

I found this in the LabVIEW help on-line

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/using_events_and_subpanels/

 

If you configure a VI to handle an event and then configure the VI you load into a subpanel control to handle the same event, the top-level VI containing the subpanel control handles the event.

 

Does anyone have an example of this?

 

This may be cool...

 

Thanks

 

Dan

Dan Shangraw, P.E.


   

0 Kudos
Message 1 of 9
(4,163 Views)
I'm not sure what the context for this statement might be, but as far as I know every VI that is registered to receive an event will catch it at the same time.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 9
(4,148 Views)

How can 2 vi's register for the same event?

 

Thanks

Dan Shangraw, P.E.


   

0 Kudos
Message 3 of 9
(4,136 Views)
It's easy. With a UDE you can have dozens of VIs respond to the event. In fact that's typically how I stop an application.

For a control reference it takes a bit more work. Pass a reference to a control on one VI to another VI. In the second VI you can use that reference to register an event on it. I will often do that if I have a subpanel VI that I want to respond to clicks of buttons on the main GUI.

Now I have never actually tried having two VIs respond to the same control event, so that may be what the old help file is talking about, but note that it is talking about a version 3 major revs ago. Another potential complication is that when you create a control event in the normal way LabVIEW by default locks out the front panel until the event is handled, that might cause an issue also. Someday when I have time I'll have to try it out for grins and giggles.

For examples of both use cases, check out my blog. Link is in my signature.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 9
(4,121 Views)

I have never found this statement to be true.  It would be a programming nightmare.

 

There may be a small subset of events which are handled by the parent VI but the VAST majority work as advertised.

 

I personally treat this statement as false.

0 Kudos
Message 5 of 9
(4,089 Views)

Intaris, forgive me, but which statement do you regard as false?

 

Bob Schor

0 Kudos
Message 6 of 9
(4,075 Views)

@Bob_Schor wrote:

Intaris, forgive me, but which statement do you regard as false?

 


Sorry, I was rather indiscriminate in my statement.

 

I'm referring to this one:

If you configure a VI to handle an event and then configure the VI you load into a subpanel control to handle the same event, the top-level VI containing the subpanel control handles the event.

 

I have often been curious about this statement and have never really found data to back it up.

0 Kudos
Message 7 of 9
(4,062 Views)

ASTDan,

 

I was curious, so attached is an example in LabVIEW 2012.

 

The Count 1 and 2 indicators receive User Event data from the respective subvis.

 

-Click on the Fire Gen Event button to send event to the main and subvis with the Generate User Event node

-Mouse up on the Fire MU Event button to send mouse event to both vis

-Click on the subvi OK button to send Mouse Up to both vis

 

I'm not sure what the Help message is referring to.

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 9
(4,014 Views)

My experience has been the same. No issue to have multiple Event structures configured for the same event. What I have been unofficially told from someone at NI is that all the warnings about using multiple Event Structures are due to the possible use of Filter events. If one of the structure is configured to filter events, you might get unpredictable behavior: some structures getting the events, and some don't.

Marc Dubois
0 Kudos
Message 9 of 9
(3,999 Views)