05-10-2018 09:42 AM
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
05-10-2018 03:53 PM
There is a property node for that:
panel=>TotalRect
It returns the rect contains all visible objects.
05-10-2018 05:51 PM
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.
05-11-2018 10:00 AM
> 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.
05-11-2018 10:41 AM
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.
Thanks,
XL600
05-11-2018 11:12 AM
I did similar to you, but I just modified the OpenG resize function so that it would ignore controls that aren't visible.
05-11-2018 12:23 PM
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 🙂