Example Code

Programmatically Set Front Panel Size and Position

Code and Documents

Attachment


Introduction

This example allows the user to specify the position of each border of the front panel. The panelbounds property adjusts the actual pane borders, not including the window borders, scroll bars, tool bars, title bar, etc., so ensure that there is sufficient clearance on all sides if you wish to see anything outside the actual front panel pane. Position values are in pixels and are in terms of absolute screen position (i.e. 0 is the top or left most pixel on your monitor).

Change FP Window bounds_BD.png


Instructions
  1. Open the VI.
  2. Enter the desired pixel coordinates for the 4 sides of the front panel.
  3. Run the VI.

The VI will position the borders of the front panel to the specified positions.


Additional Notes
Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support

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

Comments
shb
Active Participant
Active Participant
on

How can I set the size of panes? (When there are splitter bars.)

NiCoder
Member
Member
on

Introduction

This example allows the user to specify the position of each border of the front panel. The panelbounds property adjusts the actual pane borders, not including the window borders, scroll bars, tool bars, title bar, etc., so ensure that there is sufficient clearance on all sides if you wish to see anything outside the actual front panel pane. Position values are in pixels and are in terms of absolute screen position (i.e. 0 is the top or left most pixel on your monitor).

Change FP Window bounds_BD.png


Instructions
  1. Open the VI.
  2. Enter the desired pixel coordinates for the 4 sides of the front panel.
  3. Run the VI.

The VI will position the borders of the front panel to the specified positions.


Additional Notes
Ajay_MV
Active Participant
Active Participant
on

Is there any property to change the hight and width of the window in run-time?  All I can see is that I need to give all four co-ordinates (top, left, right, bottom) in order to achieve this.  I wouldn't like to give the top and left, but only the area height and width to change the window size.  Is it possible?

--
Ajay MV


crossrulz
Knight of NI Knight of NI
Knight of NI
on

Ajayvignesh_MV wrote:


                       

Is there any property to change the hight and width of the window in run-time?


                   

It looks like you will have to do something like this

Set Panel Size.png


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Contributors