To execute code based on an event, you must configure the
to handle events.
Before you configure events for the
to handle, review the
Recommendations for Event-Driven Programming
. Complete the following steps to configure an
case to handle events.
(Optional) If you want to configure the
to handle an external I/O event or a programmatically generated event, you first must dynamically register that event.
Event Structure. On the
Use dynamic events
to enable the
Dynamic Event Terminals.
Register for Events
node on the diagram and wire the output to the input of the
Dynamic Event Terminal.
Create diagram code for your event source and wire it to the inputs of
Register for Events.
Click the event selector label at the top of the
Event Structure, to view the list of available event sources from which you can choose.
Select one or more event sources for which you want to respond. Then select an event type for each event source.
The event case you configure appears as a selection option in the event selector label at the top of the
Event Structure, and the
Event Data Node
displays the data common to all events handled in that case.
Create the code you want the
to execute when the event occurs.
Place this code inside the
(Optional) Use a Timeout event to configure an
to wait a specified amount of time for an event to occur.
If no event occurs before the specified amount of time passes, the
stops handling events.
Add additional event cases as required by your application.
tab to add additional event cases.
Repeat steps 2 through 4 for each event case you want to configure.