This article describes a feature of the MGI Panel Manager Framework. Be sure to check out other articles about the framework for more information
The Window Panel Type has some built in features to help when launching new windows.
One of the required inputs when launching a Window Panel is the “Default Title”. As the name suggests, this will set the title of the VI window. There are times when a Panel will want to set its own title. This is achieved using the “Panel Data”. The Panel Data is Part of the Panel Helper class. Panel Data is a Tag-Value lookup. The Window Class looks for a tag named “Title”. If there is a value for the “Title” field, that will be the VI title. If there is no value for the “Title” field then the “Default Title” as specified by the launcher will be used.
In a regular LabVIEW front panel, you only get a few choices for how to position the window. In practice, I only ever found myself using Maximized, Unchanged and Centered. These don’t address all the use cases.
- What if I want to center in something other than the display?
- What If I want to size my window based on the size of the display?
- What if I want to cascade a bunch of windows as they’re launched?
- What if I want to implement a custom algorithm to determine the window size and position?
These are all useful, but annoying to implement.
The Window Position class provides a place to implement these sorts of algorithms in a reusable way.
The Position class is used to determine where to position the window on first show.
The most basic window position type. This will maximize the window when shown.
There are four other types of window positions. They are all Referenced Window Types because their position is based on the position of something else.
- Display – This will reference a specific display. This is the fallback case (ie, if you try to reference an object that isn’t shown, the display will be used instead).
- Top Level VI – This is the top most visible panel. This means that if you’re launching the nested panel from something in a subpanel, its reference point will be the owning window. If you’re launching the panel from another window, it will just reference that window
- VI – This will reference a specific VI’s front panel
- Control – This will reference a specific control
Once the referenced rectangle is determined, we need to determine how to place the new panel in this rectangle. This is where Alignment and Offset are used.
Alignment is simple. You can specify Top, Center, or Bottom for vertical alignment and Left, Center or Right for horizontal alignment.
There are 3 built in types of offset
- No Offset
- Absolute Offset – Absolute increments are used for the offset
- Cascade Offset – Offsets are dynamically calculated based on the number of windows show as well as their current positions
When docking and undocking into subpanels, or when launching windows in different contexts it is often useful to manually specify the size of the window to be shown.
There are 4 built in types of window size
- Unchanged – The window size will be unchanged. Note: when using subpanels and windows with re-entrant shared clones VIs (such as with panel actors) leaving the window size unchanged can often lead to unexpected window sizes.
- Absolute – Manually sets the window size. If the specified values are smaller than the Panel’s minimum panel size it will be coerced up to the minimum panel size.
- Min Panel – Sets the panel size to the panel’s configured minimum size.
- Reference – Sets the panel size based on the referenced item. This is useful for making a window take up half of the screen, or 75% of the top level VI. The referenced item will depend on the reference type.
Coming to the LabVIEW Tools Network soon!
Download MGI Panel Manager