[Lazarus] Autosize behaviour

Mattias Gärtner nc-gaertnma at netcologne.de
Wed Apr 7 14:42:27 CEST 2010


Zitat von Alexander Klenin <klenin at gmail.com>:

> On Wed, Apr 7, 2010 at 22:47, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> I agree for Constraints, but not the other two.
>
> Funny, I just argued exactly the other way around ;-)

Some properties must be handled by all Layouters. For example the  
interface constraints (you can not resize a combobox free under  
windows and a scrollbar not under gtk).

The other constraint properties makes sense in all layouters too, so I  
recommend to use them (not reinventing the wheel). They are also  
applied in all LCL code. If a layouter does not like them, I recommend  
that it clears the constraints instead of ignoring them.

Borderspacing properties could be used too in all layouts (I can  
imagine) and for consistency I recommend that they are used - at least  
- in a similar way. This is more a design guide line.

AnchorSides are only for fixed and Align controls. This is special to  
the default LCL layouter. The same for ChildSizing.


I have trouble to find the direction of this thread, so I will repeat  
my proposal:

Every TControl gets a property "Layouter: TLControlLayouter".  
TLControlLayouter gets a bunch of methods. The most important ones are  
CalculatePreferredSize and AlignControls. CalculatePreferredSize  
computes the preferred size, which the parent layouter can use.  
AlignControls resizes/positions the child controls according to the  
current bounds. If Layouter=nil then the default layouter will be used.


Mattias







More information about the Lazarus mailing list