Properly Format SubVI Panels as Modal Dialogs in LabVIEW

Friday, November 21, 2014

In most LabVIEW applications, the front panel of a subVI is displayed in order to retrieve inputs from the user, or to simply display information. By following these steps, brought to you by Darren Nattinger, you can make your subVI panels easy to develop and debug.


1. Handle the opening and closing of the subVI panel programmatically. Many LabVIEW users choose to use the SubVI Node Setup right-click option to display the subVI panel. But the downside to this option is that your subVI won’t run any initialization codes before displaying its panel. To bypass this problem use the FP.Open method to display the subVI panel once you have initialized it, and use the FP.Close method to close it once the user dismisses the subVI dialog.

 

subvi1.jpg


2. Configure the VI Properties of the subVI properly. Set the Window Appearance in VI Properties to "Custom” and customize your settings to match the image below. As you can see there are various setting changes, in particular the “Show Abort Button” option is disabled to prevent users from closing your entire application by pressing Ctrl-. while your subVI dialog is active.

 

subvi2.jpg

 

3. Call your modal dialog subVI dynamically. Whenever you run a VI, all of its subVIs are reserved for running, which means none of the subVIs are in edit mode. Any reserved subVI that has a modal window appearance will immediately be displayed if its front panel is already open. Since it is a modal window, you cannot dismiss it because it's reserved for running. The best way to avoid this problem is to call the modal dialog subVI dynamically by changing the subVI to “Load and retain on first call.”

subvi3.jpg

 

>> Get more LabVIEW tips from Darren.