There are three coordinate systems.
1. Local pane coordinate system: The origin is the gray dot on the pane inside the front panel. For most front panel objects, the position properties read with their property nodes are relative to this coordinate system. See
LabVIEW Help: Position Property for more details.
2. Global front panel coordinate system: The origin is the upper left corner of the pane.
3. Global screen coordinate system: The origin is the upper left corner of the PC screen. The mouse cursor position read with
Initialize Mouse
and
Acquire Input Data
functions is relative to this coordinate system.
In order to relate the mouse cursor position to the positions of most front panel objects, you would need the mouse cursor position relative to the pane coordinate system. The following steps explain how to calculate it programmatically.
1. Place VI Server Reference
(Programming»Application Control»VI Server Reference) and left-click This VI»Pane»Pane. Right-click Pane»Create»Property for Pane Class»Originand wire it to This VI. Read the Horizontal and Vertical coordinates included in the cluster outputted from the property node. This is the position of the upper left corner of the pane relative to the pane coordinate system.


2. Place another
VI Server Reference
, right-click on
This VI»Create»Property for VI Class»Front Panel Window»Panel Bounds, and wire them. Read the
Left and
Topcoordinates included in the cluster outputted from the property node. This is the position of the upper left corner of the pane relative to the screen coordinate system.

3. Subtract Left from Horizontal, and Top from Vertical. This is the position of the origin of the pane relative to the screen coordinate system.
4. Wire
Initialize Mouse
(
Connectivity»Input Device Control»Initialize Mouse) and
Acquire Input Data
(
Connectivity»Input Device Control»Acquire Input Data). Read the
Horizontal and
Vertical coordinates included in the
axis info cluster output of
Acquire Input Data
function.
5. Add the values of the previous step from the Mouse's coordinates. This is now the position of the mouse cursor relative to the pane coordinate system.
We add the values in this last step, as the coordinate values in Q4 in the image below are positive (+x,+y), whereas the others sectors will have negative components: Q1 (+x, -y); Q2 (-x,-y); Q3 (-x,+y).
