[Lazarus] Centered elements in autosize enabled panel. Possible?

Avishai avishai.gore at gmail.com
Sun Nov 10 22:03:06 CET 2013


You can also use Constraints to set height/width of children with
ChildSizing.


On Sun, Nov 10, 2013 at 10:43 PM, Valdas Jankūnas <zmuogs at gmail.com> wrote:

> 2013.11.10 18:24, William Oliveira Ferreira rašė:
>
>  I think you could also use anchors
>>
>
> Anchors not helps if Parent.Autosize is True.
>
> I found better solution:
> - Panel.AutoSize := True;
> - Panel.ChildSizing.ControlsPerLine := MaxInt;
> - Panel.ChildSizing.Layout := cclLeftToRightThenTopToBottom;
> - Every Child.BorderSpacing.Left := 2;
> - Every Child.BorderSpacing.CellAlignVertical := ccaCenter;
> - Every Child.AutoSize := True;
>
>
> If you want to adjust Child's Width (by default you cannot) then you must
> use overridden procedure "CalculatePreferredSize" in class of that Child,
> in which:
>
>    inherited CalculatePreferredSize(PreferredWidth, PreferredHeight,
> WithThemeSpace);
>    PreferredWidth := Width;
>
>
>
> --
>   Valdas Jankūnas
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Shalom,
Avishai
avishai.gore at gmail.com
אבישי גוֹר
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131110/a21d5a28/attachment-0003.html>


More information about the Lazarus mailing list