04-19-2019 11:43 AM
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?
Solved! Go to Solution.
04-19-2019 12:10 PM
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.
04-19-2019 02:56 PM
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.
04-19-2019 04:24 PM
OK. I got it figured out. I simply didn't handle user events well. Attached is a more "finished" setup.
04-19-2019 06:42 PM
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.