Use a subpanel control to display the front panel of another VI within the current VI's front panel. You can use subpanel controls to create a dynamic user interface like a wizard.

Use the subpanel control to display the front panel of another VI on the front panel of the current VI. For example, you can use a subpanel control to design a user interface that behaves like a wizard. Add Back and Next buttons to the front panel of the top-level VI and use a subpanel control to load different front panels for each step of the wizard.

This procedure guides you create block diagram code to use a subpanel control as follows:

Figure 7. Subpanel Control Sample Code

Block diagram showing VI reference wiring through a While Loop to Close Reference to display another front panel a subpanel control.

To load a front panel in a subpanel control, complete the following steps.

  1. Add a subpanel control to the front panel.
    LabVIEW creates an Invoke Node on the block diagram with the Insert VI method selected.
  2. Add the Open VI Reference function to the left of the Invoke Node on the block diagram.
  3. Wire the path of the VI whose front panel you want to load to the vi path input of the Open VI Reference function.
  4. Add the Run VI method to the block diagram.
    1. Right-click the vi reference output of the Open VI Reference function and select Create » Method for VI Class » Run VI.
    2. Add the Invoke Node that appears on the cursor to the right of the Open VI Reference function.
  5. Wire the vi reference output of the Open VI Reference function to the vi reference input of the Run VI method.
  6. Create a Boolean constant with a value of FALSE: right-click the Wait Until Done input of the Run VI method and select Create » Constant.
  7. Wire the vi reference output of the Run VI method to the VI Ref input of the Insert VI method.
  8. Add a While Loop (Functions » Programming » Structures) to the right of the Insert VI method.
  9. In the While Loop, create a stop button: right-click the conditional terminal (Conditional terminal for a While Loop in LabVIEW.) and select Create Control.
  10. Specify the frequency for the While Loop to run.
    1. Add the Wait Until Next ms Multiple function (Functions » Programming » Timing) inside the While Loop.
    2. Wire a numeric constant to the millisecond multiple input.
    3. Specify the number of milliseconds you want to lapse when the VI runs.
  11. Add the Close Reference function to the right of the While Loop.
  12. Wire the vi reference output of the Run VI method through the While Loop and to the reference input of the Close Reference function.
  13. Wire all error in and error out terminals on the block diagram.

Subpanel Control Examples

For examples of using subpanel controls, refer to labview\examples\Controls and Indicators\Containers\Containers.lvproj.

You can also use the SubPanel properties and methods to modify subpanel controls programmatically.