Example Code

Simple Event Structure With a Filter Event Using LabVIEW

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

Description

Overview

The purpose of the code is to demonstrate Filter Events using a stop button that triggers an event in LabVIEW.

 

Description

When you run the application it is waiting for the stop button to trigger an event. When the stop button is clicked before the Stop Button Notify event case runs the Filter case will run. In the Filter event case, it asks the user if they really want to stop the program. If the user selects No the event structure will ignore the Stop Button Notifier event and exit the event structure to wait for another event or complete other tasks outside the event structure in the while loop. However, if the user does select to stop the program from the dialog it will run the Stop Button Notifier Event and stop the program. Therefore the Notify Event Case will never run without first running the Filter Event if one exists. For more information, refer to Notify and Filter Events.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI
  2. Click the Stop Button
  3. A Dialog should appear because of the Stop Filter Event
  4. If you select No you should then see the number of iterations increment
  5. If you select Yes you should then see the number of iterations and the Number of Times the Stop Button Case increment

 

Additional Information or References

VI Snippet

Simple Event.png

 

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

Regards,

M. Whitaker
ni.com/support

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