Lazarus

Programming => LCL => Topic started by: Akira1364 on October 04, 2015, 02:52:20 am

Title: How does Child Sizing actually work, exactly?
Post by: Akira1364 on October 04, 2015, 02:52:20 am
Let's say I have a TForm, and then a TPanel on top of it. The TPanel is set to be the exact same height and width as the TForm, in order to fill the whole window. All my applications controls are attached to the TPanel. How do I have to set the TForm's "child sizing" settings to make the TPanel and all of its controls scale up and down automatically when the main TForm window is resized by the user? I have tried every conceivable combination of settings, and all that ever happens is the panel is either covered up when the window is downsized, or does nothing at all when the window is upsized (which of course reveals the empty gray form surface to the user.) What am I missing, exactly?
Title: Re: How does Child Sizing actually work, exactly?
Post by: molly on October 04, 2015, 05:47:33 am
You should start with setting the align (http://lazarus-ccr.sourceforge.net/docs/lcl/controls/tcontrol.align.html) property of your panel to alClient (http://lazarus-ccr.sourceforge.net/docs/lcl/controls/talign.html).

That makes sure your panel will have the exact same size of your form's client height and client width, even when the form is being (re)sized.

Then you would have to make sure that your layout of your components on the panel either have the proper anchor (http://lazarus-ccr.sourceforge.net/docs/lcl/controls/tcontrol.anchors.html) set _or_ use other panels to divide your layout in a layout- scheme that fits your needs.

I don't believe (pixel)scaling is provided by default LCL components (but i would have no objection if someone can proof me wrong on that subject).
Title: Re: How does Child Sizing actually work, exactly?
Post by: derek.john.evans on October 04, 2015, 08:17:45 am
How do I have to set the TForm's "child sizing" settings to make the TPanel and all of its controls scale up and down automatically when the main TForm window is resized by the user?

There was a proportional resizing thread here with a few solutions:

http://forum.lazarus.freepascal.org/index.php/topic,27402.0.html

Title: Re: How does Child Sizing actually work, exactly?
Post by: Leledumbo on October 04, 2015, 11:58:55 am
The algorithm: http://wiki.lazarus.freepascal.org/LCL_AutoSizing
How to use it: http://wiki.lazarus.freepascal.org/Autosize_/_Layout