How to Position a Front Panel Object in LabVIEW

Updated Aug 7, 2023

Reported In

Software

  • LabVIEW

Issue Details

I am trying to map a text table in a dialog box using the Position:Left and Position:Top properties. I want the table to appear in the center of the screen. However, wiring 0 to Left and 0 to Top places the table in the upper left corner, but not exactly at the top-left corner of the front panel. How can I make sure the table appears in the exact center of the dialog box?

Solution

The Position properties for a front panel object correspond to its position in the front panel window, not on your computer screen.

Setting an object's Position:Top and Position:Left properties to 0 will typically place it slightly above the visible origin in the front panel window. This is because (0,0) in the front panel is hidden behind the menu bar and toolbar. Placing an object at (0,43) will position it at the visible origin. This setting persists when running a VI in a dialog box, so an object at (0,43) will still appear at the origin. However the origin also persists when you use the scrollbars in the front panel window, so that (0,0) might not always be the correct origin. Use the FP.Origin  property to obtain the correct origin.

To position an object at the center of your screen, you should use the FP.Origin and FP.PanelBounds properties to calculate the correct center of the front panel window, then use the object's Position:Left and Position:Top properties to situate it on the center. See the following example of how to do this.
 
In LabVIEW 7.1 or earlier, refer to the LabVIEW Documentation for more information about the Position properties. In LabVIEW 8.0 or later, refer to the GObject Properties  topic in the LabVIEW help.