From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

How to Open a SubVI as a Separate Window

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

In case the subVI settings for Show Front Panel When Called/Run don't provide the flexibility or control you need for your application, you could use the VI Server to control the window state.


Description

This VI shows how to use VI server in conjunction with invoke nodes to open up a subVI as a separate window. The subVI merely takes a numeric input and writes it to a waveform chart. The main VI is actually the VI that is writing to the chart inside of the loop. The VI will write to the chart without the user seeing anything. However, if the user wants to see the chart, they can simply click the boolean switch that opens the front panel of the subVI.

The subVI's properties have been modified so that there is no run/abort/etc buttons, but is merely a "standalone" window. The user can then close the window with the boolean switch that is in the window.

You can see that the subVI passes its reference to the main VI, so the invoke node can be done through the while loop.

Note that the Chart Window subVI only writes 1 point of data to the chart per call. It relies on being in the parent VIs loop to update and to "poll" its Close This Window button.


Requirements: LabVIEW 2012 (or compatible). Hardware: none.


Steps to Implement or Execute Code

1. Run this VI.
2. Open Graph Window.
3. Close Graph Window.

 

Additional Information or References:

 

How to Open a SubVI as a Separate Window Main FP.png

 

How to Open a SubVI as a Separate Window Main BD.png

 

How to Open a SubVI as a Separate Window subVI FP BD.png


**This document has been updated to meet the current required format for the NI Code Exchange.**

Chris Van Horn
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
KrisnaWisnu
Member
Member
on

Thank you. This is what I am looking for.

Certified LabVIEW Developer (CLD)
Certified TestStand Developer (CTD)
Using LabVIEW 8.5.1 (2008) to LabVIEW 2021
sparklehose
Member
Member
on

Thank you, this is exactly what I needed. I do have one question though:

The subVI uses a close button and disables the red X in the upper right (VI Properties -> Window Appearance -> Customize -> unchecked "Allow user to close window"). I would like to allow users to close the window with the red X because that is a more intuitive UI. I see the program still works fine if I check "Allow user to close window." Is there a good reason (perhaps related to memory?) to disable the red X and use the button? Or was the subVI set up with a custom close button just to demonstrate the "FP.Close" property?