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

We appreciate your patience as we improve our online experience.

Example Code

Get Mouse Position Relative to Front Panel Origin/Gray Dot

Code and Documents

Attachment

Overview
This example demonstrates how to determine the mouse coordinates relative to the Front Panel's origin (gray dot).

 
Description
This example demonstrates how to determine the mouse coordinates relative to the Front Panel's origin (gray dot) by using VI Server references to determine the Front Panel's position relative to the origin and relative to the user's screen, and using these coordinates to calculate the mouse's position relative to the origin through the fomula.

Mouse Coordinates relative to Front Panel Origin = Local Pane Coordinates - Global Pane Coordinates + Mouse Coordinates 


Requirements

LabVIEW 2013 (or later)


Steps to Implement or Execute Code

  1. Run the VI
Additional Images or Video
 44.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

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