[Lazarus] Autosize behaviour

Martin lazarus at mfriebe.de
Tue Apr 6 13:52:53 CEST 2010


On 06/04/2010 10:33, Michael Van Canneyt wrote:
>>>> With a dedicated LayoutManager property, all anchor-docking related 
>>>> stuff
>>>> could be moved from TWinControl into the AnchoredLayoutManager, and
>>>> DockManager could be replaced (or merged with) the LayoutManager. 
>>>> In further
>>>> steps the DockClient list could be removed, the Controls list can 
>>>> be used
>>>> instead. Delphi compatibility can be maintained by delegation to 
>>>> the still
>>>> existing elements.
>>>
>>> The reason I don't want to introduce the layoutmanager property is 
>>> that it
>>> simply does not make sense for all TWinControls. a TEdit does not 
>>> need a
>>> layoutmanager, only the parent of the TEdit needs one.
>>
>> Then don't publish it for TEdit.
>
> 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 :-)
>

Hm, but something I am missing.

I see why it would be nice to avoid a published hook at all (never mind 
if it is a Layouter property, or an OnLayout event).

I can see that work, if a Layouter was always global => drop it on a 
Form, and the Layouter will grab control of all controls on the Form.

But if you want selective Autosizing (eg, just PanelX should use the 
Layouter, the rest uses the default, or yet another Layouter), then the 
user needs to configure this.

Either you need a special property editor, which opens for the Layouter, 
and allows you to add/remove controls. Or you have a Layouter property. 
IMHO the property would be fine in this case.

Martin
Or am I missing a 3rd way?




More information about the Lazarus mailing list