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: 

How to pass events from subpanel(s) to the main VI ?

hi all,

I found a lot of solutions to pass the events from the main VI to the subpanel(s) but none about passing the events from subpanel(s) to the main VI. In the attached VIs, I just want to generate an event in the main_VI.vi when I click on the button positionned in the subPanel1.vi. How can I do that ?

thanks.

Cedric

Download All
0 Kudos
Message 1 of 7
(2,599 Views)

You can always use user event.

 

However, what you should do is using the producer/consumer design in your main VI.

In your subpanel, just add the "event" to the queue.

 

George Zou
0 Kudos
Message 2 of 7
(2,597 Views)

Cedric,

 

You could use a queue to transfer the button data to your main vi.

 

See the attached files:

 

subPanel1mod - Detects a button change and Enqueues the state.

main_VI mod - uses the Timeout event to poll for data in the queue.

main_VI mod1 - gets the queue data without having to poll.

 

Like your orginals, these files are in LV2010.

 

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.
--------------------------------------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 3 of 7
(2,588 Views)

hi George,

 

Could you please elaborate a little bit more on your solutions. Could you please post a simple example of your solutions?

thanks

 

Cedric

0 Kudos
Message 4 of 7
(2,581 Views)

The other user already show you the queue method.  That's what you should do.

 

For the user event method, see attached VIs.

 

 

George Zou
Download All
0 Kudos
Message 5 of 7
(2,570 Views)

Hi George,

thank you for the examples.

My last question is how did you create the string user event refnum on the front panel. I knwo how to do it by creating a constant from the inout of the 'Generate user Event' function but not from scratch.

thanks

 

Cedric

0 Kudos
Message 6 of 7
(2,544 Views)

Right click on the output of Create Event function, choose create control.

Cut & paste onto the subpanel VI.

 

George Zou
0 Kudos
Message 7 of 7
(2,531 Views)