From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Change Cursor Appearance while Hovering Over Controls During Runtime

Code and Documents




As of LabVIEW 2011 SP1, the default cursor on the Front Panel during runtime is displayed as the familiar hand icon. However, you can programmatically change the mouse appearance with the Set Cursor VI. There are several use cases for this functionality. One example, is that you may want to provide the user with feedback when the mouse is over an active control.



The code below shows how you can use an Event Structure to register when the mouse enters the proximity of a Front Panel control. The integer value input on the Set Cursor VI dicates what the appearance of the cursor will be. LabVIEW Event Structures have cases for the various types of controls to detect specific mouse events.


Cursor VI Block Diagram.png



The current example does not programmatically add cases for all front panel objects. Feel free to expand upon the usability of this example or find other ways to implement Set Cursor!

Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.