Waits until an event occurs, then executes the appropriate case to handle that event.
The Event Structure has one or more subdiagrams, or event cases. Only one event case executes when the structure executes to handle an event. You must place the Event Structure in a While Loop to handle multiple events.
Configure event cases and events from the Item tab. To select the events an event case handles, click Select handled events on the Item tab.
To enable this terminal, select Use dynamic events on the Item tab.
Use Register for Events to define events programmatically, and then wire the event registration reference to this terminal to access those events from within the Event Structure.
By default, the dynamic event registration terminal on the right border returns the same event registration reference you wire to the input of the dynamic event registration terminal on the left border. However, if you wire a different event registration reference to the input of the dynamic event registration terminal on the right, the terminal on the right no longer carries the same data as the terminal on the left.
You can use a Register For Events node inside of an event case to modify an existing event registration reference dynamically. To modify an existing event registration reference, you must wire event references to the Register For Events node that contain the same data types as the event references contained in the event registration reference you wire to the Register For Events node.
Resize the node to view and select data elements. Time and Index are common to all events. Other data elements vary based on the event you configure.
The order of events in the Event Selector Label determines the Index of the events in an event case that handles more than one event.
Border node that identifies the event data you can modify before the user interface can process that data.
This node appears in the Event Structure cases that handle filter events. Resize the node to view inputs available for the filter event you select.
Filter events have names that end with a question mark to help you distinguish them from notify events. Use a filter event if you want to discard the event or interact with data associated with a particular user action on the panel before the Event Structure executes a subdiagram of code.
To change event data, wire and modify data items from the Event Data node to the Event Filter node. You can also change the event data by wiring new values to Event Filter node inputs. To completely discard an event, wire a True value to the Discard? input. If you do not wire a value to a data item of the Event Filter node, that data item remains unchanged.
The Event Structure can time out while waiting for notification of an event. The Event Structure executes the timeout event case you create if the structure times out. The Event Structure does not time out if you do not select the Timeout event for at least one event case.
There are two types of user interface events handled by the Event Structure: notify and filter.
Filter events have names that end with a question mark to help you distinguish them from notify events. In most cases, the VI generates an associated notify event after its corresponding filter event if no event case discarded the event. The notify event has the same name as its corresponding filter event but without the question mark.
The following table describes these types of events and when to use each type:
|Description||Informs you that a user action occurred.||Allows you to validate or change the event data before the VI performs the default action associated with that event. You can also discard the event entirely to prevent the change from affecting the VI.|
|Use Case||Use if you want to execute a subdiagram of code when the user performs a particular action on the panel.||Use if you want to discard the event or interact with data associated with a particular user action on the panel before the Event Structure executes a subdiagram of code.|
|Dataflow||The VI sends a copy of the event, in parallel, to each Event Structure configured to handle the event.||The VI sends the event sequentially to each Event Structure configured for the event.
|Example||You can configure an Event Structure to execute to handle a Value Change event when the user changes the value of a control.||You can configure an Event Structure to discard the Panel Close? event, preventing the user from interactively closing the panel of the VI.|
When you register an event, the VI notifies the Event Structure when that particular event occurs. You can register for an event statically or dynamically. A VI that contains an Event Structure automatically performs static event registration when you run it. Use the Register for Events node to perform event registration for dynamic events.
|Static Event Registration||Dynamic Event Registration|
|Description||The VI always queues the event sequentially and notifies the Event Structure when the event occurs.||The VI queues the event sequentially and notifies the Event Structure when the event occurs only if that event occurs as a result of execution of code in your VI.|
|Use Case||You want the VI to generate events only from user interaction on the panel.||You want the VI to generate events as a result of programmatic changes to elements in the VI.|
|Event Generation||Requires user interaction for the VI to generate events.||The VI can generate events without direct user interaction with the panel.
Handle events only in the VI where you generate events.
You can configure an Event Structure to specify which user interface events on the panel of a VI you want to handle in each Event Structure case.
Handle events in a subVI in addition to the VI where you generate events.
For example, in a DAQ application, you can create a subVI to handle all of the user interface events, a subVI to handle all custom events, and a subVI to handle all DAQ events for the entire application rather than handling all events in the VI where the events are generated.
|Example||If you statically register for a Mouse move event on a panel control, the VI queues this event every time the user moves the mouse over that control.||If you dynamically register for a user event, the VI queues this event when Generate User Event generates the event.|
Where This Node Can Run:
Desktop OS: Windows
FPGA: This product does not support FPGA devices
Web Server: Not supported in VIs that run in a web application