LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resize and center FP window to all visible controls

Is there any community VI which will scan a FP for visible controls and resize and center the FP window on those controls?  Maybe even one which can exclude selected controls (Like error in and out)?

 

I ask because I resize controls programmatically, but want a generic way to resize the FP to those resized controls are entirely visible (Up to some limit of course).

 

I do use the OpenG Resize to largest decoration Vi quite a bit, but that only works for static decorations.

 

Thanks,

 

xl600

0 Kudos
Message 1 of 7
(3,750 Views)

There is a property node for that:

panel=>TotalRect

 

It returns the rect contains all visible objects.

 

George Zou
Message 2 of 7
(3,713 Views)

I saw that, but it includes all visible objects.  I wound up iterating through Controls[] and Decor[] and excluding both named (EX: "error in") and by-reference controls.

 

Weird thing:  If TotalRect is handed a VI, the origin is the upper left of the VI window (Upper left of the menu bar!).  If handed a control within a VI, the origin is the origin point of the VI object placement area (Not the same).  So Using the VI's TotalRect doesn't help here.

0 Kudos
Message 3 of 7
(3,705 Views)

Weird thing:  If TotalRect is handed a VI, the origin is the upper left of the VI window (Upper left of the menu bar!).

 

That's Windows' client coordinate.  A shift of 46 pixels to LabVIEW coordinate.

Because LabVIEW does NOT use Windows' menu bar.

LabVIEW menu bar is in the client area, so does the toolbar.

 

 

 

George Zou
0 Kudos
Message 4 of 7
(3,685 Views)

Is it always 46 pixels?  It'd be nice if the LV help would mention the difference.

 

Regardless, I just avoided it and used the bounds from each control (minus selected controls) to determine an origin based bounds which I then pass into a vi that resets the VI origin and adjusts the VI bounds (Almost identically to the OpenG Fit VI window to Largest Decoration.vi but for controls plus decorations plus user margin).  Resetting the VI origin is the key to avoiding those extra pixels from the VI TotalRect property.

Untitled.png

Thanks,

 

XL600

0 Kudos
Message 5 of 7
(3,674 Views)

I did similar to you, but I just modified the OpenG resize function so that it would ignore controls that aren't visible.

0 Kudos
Message 6 of 7
(3,666 Views)

I was shooting for the following:

 

Able to expand and contract when controls are resized programmatically

Able to selectively choose what is included (EX: Switchable between 'development view with error indicators' and 'user view')

 

 

 

Working pretty well 🙂

0 Kudos
Message 7 of 7
(3,658 Views)