[Lazarus] Autosize behaviour
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Wed Apr 7 12:24:49 CEST 2010
Michael Van Canneyt schrieb:
>>> Now the TControl/TWinControl classes have a set of properties that is
>>> the
>>> union of all properties of a large set of layouters (because it must
>>> mimic
>>> the behaviour of all these layouters put together):
>>> * AutoSize
>>> * Anchors
>>> * Align
>>> * Constraints
>>> * BorderSpacing
>>> * ChildSizing
>>
>> 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.
>> For example I know many students using the java layouter. They are
>> seldom happy with the result and often use a fixed layout and program
>> anchors.
>
> Maybe the Java layouter is simply no good ?
The Java layout managers are fine, but their use requires discipline,
and a concept before one starts to code or drag&drop controls onto a
form. The same for any layout, regardless of how a GUI is composed or
managed.
Some more ideas:
It would help beginners when some visual feedback were given by a visual
GUI designer, about e.g. anchors or the direction of expansion within
every frame. A simulation of other languages were fine, because English
texts sometimes are 50% shorter than the same text in other languages.
All Autosize controls should have two degrees of freedom, i.e. they
should be capable of splitting text, tabs or buttons into multiple
lines, when the horizontal extent is limited. Every regular layout
manager should manage one restricted and one free direction of extent,
where it receives or determines the extent in the restricted direction
itself, and returns the resulting extent in the free direction. Both the
minimal and maximal extents can be returned at the same time, depending
on the minimal (required) and maximal (available) extent in the
restricted direction.
DoDi
More information about the Lazarus
mailing list