Example Code

Prevent Front Panel Close Using Event Structures

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
To prevent a user from closing a VI unless they use the Stop button that the developer has placed on the front panel.

Description:
Using Event Structures in LabVIEW, we have the ability to prevent a user from closing a VI unless they use the Stop button that the developer has placed on the front panel.  For instance, if a developer has designed for the program to implement a proper shutdown procedure when the Stop button is pressed, clicking the Red "X" may prevent this procedure from occurring properly.  This example prompts the user to close when the Red "X" is clicked and properly stops the program if they choose that option.  This is similar to this Example Code using this "Panel Close?" event, but with additional functionality.

Instructions:
To implement this example:

  1. Run the VI
  2. Observe how the VI works while it runs

To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

bd.pngfp.PNG

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

Regards,
Austin S.

National Instruments
Academic Field Engineer

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