One control combination that our LabVIEW development team uses to build modular adaptive user interfaces is the radio button, subpanel pairing. Using the radio button to switch between vis displayed in a subpanel essentially allows you to make a tab control that scales with the front panel during resizing events.
I built the vi shown in Figures 1 & 2 (linked here) to demonstrate how to insert dynamically called vi’s front panels into a subpanel. In this example each radio button inserts a different 3D graph example vi into the subpanel by its reference.
Since the vis used in the subpanel are called dynamically, some extra steps may be required to build the exe. The link below shows how to build an exe that uses dynamically called vis using the application builder. I have also included some path tips that are useful when building LabVIEW executables (exe).
Figure 2 – Inserting a VI into a subpanel block diagram.Steps for Inserting a VI into a Subpanel
- Assign VI Name to a Button or Tree Item.
- Insert File Name into the Relative Path containing VIs to show in the Sub Panel. See Notes
- Open a reference to the VI.
- If the VI is in the Idle state then run the VI.
- Insert VI into the Subpanel via a reference.
- “..” will cause the Build Path VI to strip path once.
- \ One extra \ is required per folder because the format into string function interprets backslashes as escape characters.
You can also use a tree control instead of a radio button to control which vi is inserted into the control panel. An example of this method is illustrated in a previous blog titled “Building a Modern User Interface in LabVIEW“. The vi shown in that blog uses a similar technique for building and selecting the which vi will be inserted into the subpanel.
Figure 3 above is a vi snippet of the Insert VI invoke node for a Subpanel. If you already have a subpanel, right click on the subpanel, create a reference and wire it to the subpanel invoke node.