[Lazarus] Autosize behaviour

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Apr 7 05:38:11 CEST 2010


On Tue, 6 Apr 2010 15:33:54 +0200 (CEST)
Michael Van Canneyt <michael at freepascal.org> wrote:

> [...]
> > How can a designer tool find out what layout a control uses?
> 
> Why does it need to know ?
> 
> If it needs to know what layout a control uses, the designer is flawed by
> design:
> 
> There may be layouters that the designer has no knowledge of, and
> hence if such a layouter is dropped on the form, the designer will
> be lost.

I can't follow you here.
For example: I dropped several layouters on my form. Now I want to know
what layouter my Panel1 uses. But I can't find out because that would be
flawed by design?
Maybe you can give some more details how you want to setup the
layouts in the designer.

 
>[...]
> > How would you do that?
> > For example you want a group of TEdits to position/resize according to 
> > a policy, so you set for all your edits a layouter.
> 
> I don't see what is to store in the TEdits ?
> The 'policy' is a property of the layouter, not of the TEdits.

The reference to the layouter should be stored in the TEdits.
For example: the layouter of Edit1 is Layout1. It does not matter what
specific type Layout1 is.

 
>[...]
> No problem when using layouters: just create/adapt a new layouter class.
> 
> The simplicity and clarity is the following:
> 
> Layouter: Layouter manages everything. Each layouter has a few simple
> properties that determine it's (and only it's) behaviour, and no more.
> 
> 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 difference, each layouter would have only the properties that it
> needs to implement it's behaviour. That is simple to understand.

Yes, but not as simple to use. 
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.
Layouters are easy to program and easy to explain but awkward to create
nice designs.

 
> >> Currently, the layouting is simply a mess, with added ad-hoc properties
> >> and no clear rules that determine which property has precedence over 
> >> other properties.
> >
> > See here:
> > http://wiki.lazarus.freepascal.org/Autosize_/_Layout
> 
> I find the concept of a layouter with 1 or 2 properties more clear
> than all these properties thrown together.

Of course.
But in the end the important part is a simple GUI to use the layouts.


Mattias




More information about the Lazarus mailing list