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
(3,187 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
(3,185 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

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 3 of 7
(3,176 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
(3,169 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
(3,158 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
(3,132 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
(3,119 Views)