Caveats and Recommendations when Using Events in LabVIEW
Because LabVIEW is a graphical programming interface, handling events is different from handling events in other programming languages. The following list describes some of the caveats and recommendations when incorporating events into LabVIEW applications:
If a While Loop that contains an Event structure terminates based on the value of a latched stop Boolean control, remember to handle the latched stop Boolean control in the Event structure.
When using dynamic registration, make sure you have a Register For Events function for each Event structure.
If you register for the same event on both a VI and a Control class, LabVIEW generates the VI event first.
When using subpanel controls, the top-level VI containing the subpanel control handles the event.
If you need to generate or handle other events while handling the current event, consider using the Register Event Callback function.
Use caution when selecting between a notify or filter event. An event case configured to handle a notify event cannot affect if or how LabVIEW processes a user interaction. If you want to modify if or how LabVIEW processes a user interaction, use a filter event.
Do not use the Panel Close notify event for important shutdown code unless you have taken steps to ensure that the VI does not abort when the panel closes. For example, be sure the application opens a reference to the VI before a user can close the front panel. Alternatively, you can use the Panel Close? filter event, which occurs before the panel actually closes.
If no Event structure executes promptly to handle an event and front panel locking is enabled, the user interface of the VI may become unresponsive. You must ensure that the Event structure is in a loop that runs often enough to respond to user interface events in a timely manner or disable front panel locking.