Can I Use Multiple Event Structures to Handle the Same Event in LabVIEW?

Updated Aug 24, 2023

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Issue Details

Can I use multiple event structures to handle the same event in LabVIEW?

When I try this, sometimes it will work, but other times the VI will only activate the next structure in the data flow. Is there a way to control whether all event structures activate or just the next one in the data flow.

Solution

To get all event structures to respond to the same event, they need to be configured for the same notify event. This places the event in individual queues for each event structure.

When you configure two event structures to respond to the same filter event, only the next structure to arrive in the dataflow will include the event in its queue. Because of this, it can lead to race conditions in which the behavior of the VI varies on which event structure received the event. NI discourages LabVIEW developers from registering the same filter event in multiple event structures

Additional Information

Filter events are designated with a question mark symbol to distinguish them from notify events.

Many of the problems caused by having multiple event structures registered for the same filter event can be corrected by implementing the User Interface Event Handler design pattern. This will allow the developer to more easily control the behavior of the VI because only one event is handled at a time. A template for this design pattern can be found by selecting File>>New>>VI>>From Template>>Frameworks>>Design Patterns>>User Interface Event Handler.