Example Code

Change Cursor Appearance while Hovering Over Controls During Runtime

Code and Documents

Attachment

Description

Introduction

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.

 

Implementation

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

 

Closing

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!

KyleP
Applications Engineer
National Instruments

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

Contributors