Step 1: Create a Placeholder for the Event You Want to Occur Only Under Certain Circumstances

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

Use a placeholder to register for an event you want to monitor once a specific condition occurs in the application. The placeholder creates an entry in the Register For Events function for a specific event but does not allow LabVIEW to generate that event for the placeholder object. When you wire the refnum output of a Register For Events function to the refnum input of another Register For Events function, the function that accepts the refnum contains the existing registration information. Therefore, you can modify the registration information in the Register For Events function by replacing the placeholder object with a valid object reference.

What to Use

Use the following block diagram objects to modify event registration dynamically.

VI Server Reference Register For Events While Loop Event Structure

What to Do

Create the following block diagram to dynamically register for events and to create a placeholder for the event you want to register at a different location in the application. This example modifies registration dynamically so that the Mouse Move event on the VI pane triggers only when the user clicks the picture control on the front panel.

The following list describes important details about the previous step.

Dynamically register the Mouse Down and Mouse Up events for the picture control reference.
To create a placeholder for an event, you can wire a refnum constant to the Register For Events function. Because the value of a refnum constant is Not a Refnum, LabVIEW registers the Mouse Move event on an invalid object. Therefore, no Mouse Move event occurs until data flow allows LabVIEW to register the event on a valid object. In the previous block diagram, a strictly-typed refnum constant for the pane of the current VI is wired to the Mouse Move event. To create this refnum constant, you can click a VI Server reference and select Pane from the shortcut menu. Right-click the Pane reference and select Create»Constant from the shortcut menu.

After you register a placeholder for the event you want to occur only under certain circumstances, design an event case to specify when you want LabVIEW to register for the event.


Not Helpful