|LabVIEW 2016 Help|
|LabVIEW 2017 Help|
|LabVIEW 2018 Help|
|LabVIEW 2019 Help|
|LabVIEW 2020 Help|
Use the following block diagram objects to dynamically register events.
|Register For Events||While Loop||Event Structure||Unregister For Events|
The following list describes important details about the previous diagram.
|Obtain VI Server references to the objects for which you want LabVIEW to generate events. To obtain a control reference constant, like the string control constant from the previous illustration, use a Property Node to query the VI for its controls or right-click the control and select Create»Reference from the shortcut menu.|
|Use the Register For Events function to dynamically register for events. You can register for multiple events for a single reference by resizing this function and selecting another event. Click the down arrow on the event source input and select the event you want LabVIEW to generate for the reference, such as the Mouse Enter and Mouse Leave events shown in the previous illustration. After registration, LabVIEW queues events as they occur until an Event structure executes to handle the events.|
|Tip You can view the registered events in the Context Help window when you hover over the event registration refnum.|
|Right-click the event selector label to display the Edit Events dialog box. Use the dialog box to configure an Event structure to handle a dynamically registered event. The Event Sources section of the dialog box contains a Dynamic subheading that lists each dynamically registered event source. After you select the events you want the Event structure to handle, design the case to handle the event data.|
|Use the Unregister For Events function to stop event generation. When the Unregister For Events function executes, LabVIEW unregisters all events the event registration refnum specifies, destroys the event queue associated with the event registration refnum, and discards any events that remain in the queue.|
Refer to the labview\examples\Dialog and User Interface\Events\Events.lvproj for examples of dynamically registering events.