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:

  • Ensure that Event structures can handle events whenever events occur.
  • Remember to read the terminal of a latched Boolean control in its Value Change event case.
  • Use a Case structure to handle undo operations for a latched Boolean control.
  • Use caution when you configure one case to handle multiple notify events.
  • You cannot configure one case to handle multiple filter events with different event data.
  • 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.
  • Consider using the Wait for Front Panel Activity function if you do not need to monitor specific front panel objects programmatically.
  • User interface events apply only to direct user interaction.
  • Avoid using dialog boxes in an event case with the Mouse Down? filter event.
  • Avoid placing two Event structures in one loop.
  • Avoid using multiple Event structures in the same VI.
  • 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.