From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Passing control information between front panel and subpanel

Solved!
Go to solution

I have instantiated a multiple subpanels within tab controls using the RunVI property for each VI.  On the main front panel, I have some simple buttons (Run, Apply, Save) that need to be applied to all subpanel VIs.  In each subvi, I have the same Run, Apply, Save controls, invisible all wired as inputs to the subvi call.  I can create an event structure in all the subvi's that handle changes successfully.  Now, I simply want to tie the FP buttons to the subvi controls. 

 

How do I simply cause the event to be replicated in each of the subvi?

0 Kudos
Message 1 of 5
(2,509 Views)

Create custom user events, sharing the references among your VIs as needed.  When a button press fires its event, use the "Generate user event" with an appropriate reference to cause it to fire those events in the other VI.

 

Here's a small guide I found.

0 Kudos
Message 2 of 5
(2,503 Views)

Is there a guide specifically regarding how to do this with subvi's implemented as part of subpanels?  I seem to be stuck on this for some reason... I have registered the event as requested.  When I open the VI, and run it using invoke, I can get the subpanel to work just fine, except that I cannot trap on any user generated events (I can't even pass the refnum for the events to the subvi, so far as I can tell).  I am probably doing something really basic, but I have spent hours looking for documentation to support this.

0 Kudos
Message 3 of 5
(2,482 Views)
Solution
Accepted by topic author northbaylabs

OK.  I got it figured out.  I simply didn't handle user events well.  Attached is a more "finished" setup.

0 Kudos
Message 4 of 5
(2,477 Views)

I had a quick look and while I see that it's working, I would offer some advice:

 

1. It's better to pass the event reference and then register in the subVI, instead of passing the registration.  The main reason is that the registration changes data types every time you add a new user event, so if you ever add more you constantly have to update any subVI it passes through.

2. It's better to use a Static VI reference and right-click it to change it to "statically typed" in order to get the connection pane of the subVI.  That way it auto-updates if your subpanel VI needs new inputs.

3.  It's better to use the static VI reference to get the path to the sub-panel VI (property node --> VI Path property) than it is to just use a path constant.  If you ever move VIs on disk or build an EXE the constant reference breaks while the static VI's property node always works.

0 Kudos
Message 5 of 5
(2,464 Views)