Control When the Front Panel of a SubVI Opens in LabVIEW

Updated Jul 18, 2018

Reported In

Software

  • LabVIEW

Issue Details

  • I have a SubVI that I am calling from a top-level VI in LabVIEW. I want to be able to control whether or not the front panel of the SubVI pops up when it is called. How can I do this?
  • How do I set the front panel of a SubVI to be opened when I call it in my application? How can I control when I want it to be shown?

Solution

There are three options to control the behaviour of a SubVI front panel:
  • Set the VI to open its front panel whenever it's called

If you want the behavior of the SubVI front panel to be the same each and every time it is called, then you will want to modify the Window Appearance properties of the SubVI.

  1. On the block diagram of the top-level VI , double click on the SubVI icon to open.
  2. Open the SubVI's properties by doing one of the following:
    1. Go to File»VI Properties
    2. Right-click on the SubVI icon in the top, right-hand corner of the front panel or block diagram and choose VI Properties
    3. On the SubVI, Press Ctrl+I
  3. In the Category drop-down menu choose Window Appearance 
  4. Click the Customize... button
  5. Here you will find three options in the bottom left for controlling the behaviour of the SubVI front panel:
    • Show front panel when called - opens the front panel when the SubVI is executed
    • Close afterwards if originally closed - closes the front panel when the SubVI finishes execution
    • Show front panel when loaded - opens the front panel when the SubVI is loaded into memory
 
 
  • If you want to open the front panel of a specific SubVI instance
If you want the SubVI front panel to open when you call it, you will have to configure the top-level VI.  This second method is useful if your SubVI appears in your top-level VI several times and you only want it to open the front panel some of the time.
  1. From the block diagram of the top-level VI, right-click on the SubVI and choose SubVI Node Setup.

  1. In the SubVI Node Setup, you will find four options for controlling the behaviour of the SubVI front panel:
    1. Open Front Panel when loaded - opens the front panel when the SubVI is loaded into memory
    2. Show Front Panel when called - opens the front panel when the SubVI is executed
    3. Close afterwards if originally closed - closes the front panel when the SubVI finishes execution
    4. Suspend when called - halts execution and allows user to run the SubVI any number of times
 
 
  • Programatically decide if the front panel opens at Run-Time
To programmatically determine whether the front panel loads or not during runtime you can use invoke nodes on the block diagram of the SubVI to control the front panel behaviour.
  1. ​Create a VI Server Reference on the block diagram for a constant OR create a VI Refnum on the front panel of the SubVI.
  2. Place an invoke node and choose the Front Panel » Open or Front Panel » Close methods to open and close your front panel. 
  3. The image below shows how to programmatically open and close the front panel of a SubVI. The false case of each case structure contain no functions. 

Additional Information

If you are using the Start Asynchronious Call VI, be sure that its connector pane matches the connector pane of the VI you are calling. Read more about Asynchronously Calling a VI and Collecting the Results in the LabVIEW Help. This and other topics are also covered in the Advanced Architectures in LabVIEW course.

WAS THIS ARTICLE HELPFUL?

Not Helpful