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

Avishai avishai.gore at gmail.com
Sun Nov 10 22:42:17 CET 2013


What I don't like about ChildSizing is if you need to change the order of
controls it can be difficult.  And here's something you should try.  Have a
TPanel as one of the Children - get everything set the way you want with
ChildSizing - now add a TLabel to the TPanel.

Using LeftAlign it's only a matter of dragging the control to the location
you want. BorderSpacing and Constraints gives me all the control I need (so
far - I'm still playing with it).


On Sun, Nov 10, 2013 at 11:03 PM, Avishai <avishai.gore at gmail.com> wrote:

> 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
> אבישי גוֹר
>



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


More information about the Lazarus mailing list