PDA

View Full Version : How does the <resize> control determine which controls on a form to resize?



Minty23185Fresh
January 31st, 2018, 20:02
The dialogs used by the Library are based on the <masterindex> windowclass. One of the controls on the form is a <windowlist> named "list". When the user resizes the form (a.k.a. window) the list resizes to occupy any created "empty space" or contracts to accommodate shrinking space.

My Field Filters for all Libraries extension (https://www.fantasygrounds.com/forums/showthread.php?40954-Field-Filters-for-All-Libraries) has two <windowlist> controls on it. How come the <resize> control preferentially picks the original "list" instead of my "filterlist" to be the control to expand or to shrink as the form resizes?

I know that the "preferred" control or control's can be chosen; it's not arbitrary, nor first-defined-first-served, nor random. The party sheet does a real cool resizing of four text based controls as the form resizes.

Two other threads ("How to resize..." (https://www.fantasygrounds.com/forums/showthread.php?37199-How-to-Resize-a-Window) and "... multiple scrollbars" (https://www.fantasygrounds.com/forums/showthread.php?41129-Resizable-Form-Containing-Multiple-Scrollbars)) both hint at the answer, but don't quite get there. I've looked at the <resize> control and it's based on <genericcontol>. I don't see code specific to resizing making me believe the functions are "builtin" and not exposed for my enjoyment.

As I write this it has dawned on me that the answer might be due to control anchoring. Controls that are anchored to the edges of the form (specifically the right and bottom edges) would probably shrink or expand when the window does. Please confirm. Is this how it is actually effected?

Thank you.

Moon Wizard
January 31st, 2018, 21:29
The "resize" control is literally just a visual indicator, and actually has no functionality. All of the actual determination of where the window resize is allowed is based on the insideoffset tag of the frame assigned to the window.

Whenever a window is resized, the window is laid out again based on the anchors and static bounds areas defined for the controls, in the order that the controls are defined in the windowclass. So, yes, the answer you've arrived it is correct, that the controls are anchored to the sides of the window, which allows them to grow/shrink when the window is resized.

Regards,
JPG