Register For Events Function

Owning Palette: Events Functions

Requires: Base Development System

Dynamically registers events. The events for which you can register depend on the type of the reference you wire to each event source input. Wire the event reg refnum out output to an Event structure or to another Register For Events function.

Details  Example

 Add to the block diagram  Find on the palette
event registration refnum is a reference to an existing event registration a Register For Events function created.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
event source 1..n is a reference to an application, VI, control, or user event. References must be to local objects. You cannot wire a reference to a remote object. If you wire an array or cluster of refnums to this input, LabVIEW registers all elements of the array or cluster for the event.
event reg refnum out returns the reference to a new or existing event registration.
error out contains error information. This output provides standard error out functionality.

Register For Events Details

When using dynamic registration, make sure you have a Register For Events function for each Event structure.

Each event source input is a reference to an application, VI, control, or user event. Each kind of event source can produce a variety of events. To specify which event you want LabVIEW to begin detecting for a particular event source, right-click the data item for the event source and select the event to detect. After this function executes, LabVIEW detects, or registers, every repetition of that event that occurs. LabVIEW stores these events in a queue so that an Event structure can handle the events later in the VI.

You can wire the event reg refnum out terminal of the Register For Events function to the dynamic event terminals on the Event structure border, to the Unregister For Events function, or to the top left input of another Register For Events function. If you wire the top left input of the Register For Events function, the function modifies the existing registration information associated with that refnum instead of registering the event again.

Registered events stay registered until you explicitly unregister them or until the VI that registered the events finishes running or you abort the VI. If the VI which registered for events was a subVI, events are unregistered when that VI's top-level VI finishes execution or is aborted. If you use the Run VI method to execute a subVI that registered for events, events are unregistered when the subVI finishes execution or is aborted.

Note  LabVIEW does not include an event registration refnum on the Controls palette because the event registration refnum is strictly typed and a generic version does not exist. You can create an event registration refnum by configuring a Register For Events function or right-clicking the function and creating a control or indicator from the shortcut menu. You also can select the part of the application that includes the event registration refnum and selecting Edit»Create SubVI to create a subVI from the selection. If you later modify the Register For Events function and change the type of the event registration refnum, you must recreate the control or indicator to match.

Example

Refer to the Dynamic Event Generation VI in the labview\examples\Dialog and User Interface\Events directory for an example of using the Register For Events function.

 Open example  Find related examples