Introduced in LabVIEW 7.0, the Subpanel is a container that is used to display the front panel of a subVI within the front panel of a Main VI, allowing users to interact with the subVI's front panel controls within the bounds of the main VI. The most typical use-case that I've encountered for a Subpanel is in conjunction with a VI which is being run parallel to the main application using VI server. In this common scenario, a reference to the VI is opened, the VI is set to run using an Invoke Node, and its reference is inserted into the Subpanel. Subpanels are a cool and flexible way to encapsulate modular and re-usable functionality, to access controls in a daemon, and to implement plug-in architectures.
The following code snippet shows a neat trick which you can implement using a Subpanel: a universal subVI front-panel viewer. This utility opens up a reference to the target VI specified by the Path Control, and in turn, references are opened to all dependent subVI's within the target's hierarchy. A ring control receives the names of the subVI's, which allows the user to select the desired subVI to view. As long as the subVI is not already in memory (previously opened front panel, for example), this is a neat way to view the controls and indicators of any subVI within the main application.
In the next installment, we'll look at another way to creatively and profitably use Subpanels, in what I call "the poor man's XControl."
LabVIEW 2016 and NI Technology Preview
6 months ago