Programmatically Move the Front Panel to a Desired Position Using LabVIEW

Updated Dec 29, 2022

Environment

Software

  • LabVIEW

How can I programmatically move my front panel to a desired position on my screen?

This method uses the coordinates of the front panel to set the position. You need to find the coordinates first, and then set the position of the front panel.

Find the Coordinates of the Front Panel

  1. Insert a property node into your Block Diagram.  You can find the property node by right-clicking on the Block Diagram and selecting Application Control»Property Node
  2. Make the property node for class VI.  You can do this by right-clicking on the yellow portion of the property node and then choose Select Class»VI Server»VI»VI.
  3. Select the Window Bounds property by clicking on Property»Window»Window Bounds.
  4. Create an Indicator for the output. You can do this by right-clicking the output of the property and select Create»Indicator.
  5. Size and place your front panel where you would like on your screen.
  6. Run the program.
  7. Record the output from the Window Bounds.  These are the coordinates you want for your front panel.

Set Position of Front Panel

  1. Delete the Window Bounds Indicator.
  2. Change the property from read to write.  To do this, right click the property node and select Change to Write.
  3. Create a constant to go into the property. To do this, right click the input into the Window Bounds property and select Create»Constant.
  4. Input the coordinates from the previous section into the constant.

Additional Information

  • If you want to simply center the front panel, you can use an invoke node of class VI.  Select Front Panel»Center.  
  • If you want to lock the window size and position during runtime, you can put the Window Bounds property node inside of a while loop.