|Download Help (Windows Only)|
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 Examples
|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 VI or function runs.
The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
|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. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces.
Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
Each event source input is a reference to an application, VI, control, or user event. You can right-click each data item and select which event to register for that event source. 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.|
Refer to the following VIs for examples of using the Register For Events function: