该内容不适用于您选择的语言

该内容将以另一种语言显示出来。 您可使用浏览器的翻译功能查看内容。

Programmatically Close Selected SubVIs Front Panels?

Updated Nov 16, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have a main VI that calls several VIs, and at certain times I would like to close all open front panels. How can I close all of the front panels that are open, with the exception of select VIs that I specify?

Solution

Using VI server, you can obtain a list of all VIs that are in memory and then open references to each of the VIs. Once you have opened a reference to a VI you can check to see if its front panel is open and if so you can close the front panel. The attached example program (built for LabVIEW 2012) shows how this can be implemented. 

In the example below, an array control specifies a group of VIs to exclude from closing. The VI then opens a reference to each of these VIs and compares their names to a list of all open VIs in memory. If the VI is open in memory AND it is not in the exclude list, then the example checks to see if the VI's front panel is open. If it is, then the example closes the VIs front panel and closes all references to the VI. Note that a VI is unloaded from memory when it's reference is closed.

You can also configure a VI to close after it completes during edit-time. To select the behavior of the subVI's front panel when called, right-click the subVI and select SubVI node setup.