[Lazarus] Autosize behaviour

Michael Van Canneyt michael at freepascal.org
Tue Apr 6 14:36:39 CEST 2010



On Tue, 6 Apr 2010, Mattias Gärtner wrote:

> Zitat von Michael Van Canneyt <michael at freepascal.org>:
>
>> [...]
>>>> I would use a mechanism similar to the datalink. As soon as you tell the
>>>> layout manager to manage a certain control, a hook is installed in the
>>>> control.
>>> 
>>> And where is the hook stored?
>> 
>> In TWinControl, protected or even private.
>
> And how to find out which layout a control uses?

The control has no need to know which layout it uses.
It just needs to know that it must handle positioning/sizing over to the layout.
(through the hook).

>> [...]
>>> Then don't publish it for TEdit.
>
> Btw, even a TEdit can need a layout to store extra properties, for autosizing 
> itself, for special docking, for alignment or for designer specials.

I don't believe this should be so. 
If this is so, then the layouting is badly designed.

>> I understand this, I thought of this also. But I think it is more clean if 
>> the hook is hidden completely; This
>> way one cannot 'forget' to publish it or publish it when it is not
>> needed.
>> 
>> Finally, it doesn't really matter. To my taste, my solution is cleaner.
>> 
>> Opinions may vary on what 'clean' is, of course :-)
>
> Your solution seems somewhat limited to the ExtJS layouts.

Maybe, but it has the advantage of being very clear and simple.
And I think clarity is a virtue, for which I am prepared to sacrifice
a few corner cases.

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.

Michael.


More information about the Lazarus mailing list