[Lazarus] Autosize behaviour

Alexander Klenin klenin at gmail.com
Wed Apr 7 13:56:42 CEST 2010


On Wed, Apr 7, 2010 at 21:24, Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
>>> Only Align, Anchors and ChildSizing.Layout are layouts. The rest are
>>> details that apply to all layouts. See the layouters of gtk.
>>
>> In my view, this is not correct. Borderspacing, Constraints and AutoSize
>> are also properties used in layouting. I see no reason why a control would
>> have these properties (assuming we were to move all layouting to a
>> separate component).
>
> IMO it's quite simple. A layout affects the position of child controls
> inside a container control, nothing else. Borders, Constraints and Autosize
> are general properties of all controls, which must be handled in/by the
> control itself.

It is not quite that simple. Obviously, the layouter must take into account
some control properties, like Constraints.
Also, some control properties, like Align and Constraints, are
layouter-specific,
and some, like Borders, are not.
So the most correct and general (although maybe not the easiest for user) way
is to separate the concept of TLayouter and TLayouterParams.
The former is assigned to "container" controls like TPanel, and governs the
algorithm used by the container to position it's children.
The latter is assigned to all controls, and serves to store the
parameters like Align,
used by parent controls layouter.

-- 
Alexander S. Klenin




More information about the Lazarus mailing list