To handle a .NET event, you must register for the event and create a callback VI to
handle that event.
Before you begin, complete the following
Complete the following steps to register and
handle .NET events.
Use a .NET Interface document to create a .NET object from LabVIEW NXG.
Add the Register Event Callback node to the diagram.
Wire the reference or object to Event on the
Register Event Callback node.
Expand Event on the Register Event
Callback node and select an event.
(Optional) Wire the data that you want to pass to the callback VI to
Right-click VI Ref and select Create
Callback VI to generate a VI based on the event you select and
the data you wire to user parameter. LabVIEW NXG wires
the callback VI to VI Ref.
You can use an existing VI as a
callback VI as long as the connector pane of that VI matches the connector pane of the
event data. The callback VI must be reentrant and the reference to the callback VI must
be strictly typed.
Open the callback VI and edit the diagram to handle the event.
If you want to pass any
part of event data through the callback VI, you must wire event
data to event data out.
Until you unregister for events, LabVIEW NXG continues to
generate and queue the events as long as the VI runs, even if no Event
Structure is waiting to handle them. This behavior consumes memory
and can hang the VI if you enable front panel locking for the events. To avoid this,
unregister for events when you no longer need to handle them using the
Unregister For Events node.