How to Determine the Position of a Control in Screen Coordinates

Updated Nov 29, 2022

Reported In

Software

  • LabVIEW

Issue Details

I need to know the location of a control on one of my VIs, but when I use the position property for that control, it relates to the LabVIEW origin rather than the screen origin. How can I determine the position of a control in screen coordinates?

Solution

The position of the front panel objects is given using the LabVIEW coordinate system, which gives the position in relation to the front panel origin. The origin is shown as a darkened crosshair on the front panel when editing.

In order to determine the screen position of a control, you can use a built in method in order to convert the coordinate. In older versions of LabVIEW, you must combine several properties to accomplish this task. Follow the directions that correspond to your version of LabVIEW.

LabVIEW 8.x and later
You can use the Convert Screen To Panel Coordinates Method, which is a method of the Panel object. An example of this is shown below.
 

LabVIEW 7.1 and earlier
You can convert LabVIEW coordinates into screen coordinates by subtracting the Front Panel Origin property from the Front Panel Bounds property, as shown in the following image. This gives the LabVIEW origin in screen coordinates.