[Lazarus] Autosize behaviour

Michael Van Canneyt michael at freepascal.org
Tue Apr 6 16:18:34 CEST 2010



On Tue, 6 Apr 2010, Hans-Peter Diettrich wrote:

> Michael Van Canneyt schrieb:
>
>>> I wonder how you want LCL code to use a dropped layout component. When no 
>>> predefined property exists, every TWinControl had to be searched for an 
>>> according component, whenever a layout method or property shall be 
>>> accessed.
>> 
>> 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 do you want to store layout specific information?

In the layout component, obviously. Where it belongs.

It does not belong in the control. If you use a layouter,
all control is passed to the layouter, and hence also all
extra information needed to realize the layout.

>>> 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.
>
> There is much stuff that doesn't make sense for all controls.

That should be a good reason for not adding more stuff.

>>> What should be complicated, when the Delphi layout manager is one of 
>>> multiple available managers? How do you want to implement different layout 
>>> management for parts of a form?
>> 
>> Simply drop 2 layouters, and point them to the right parts of the form.
>
> With the result that the form is crowded with layouters :-(

I would be very surprised to see more than 4 layouters on a form.
Most forms will have a single TTableLayout or TBorderLayout component, 
and that's it.

> Not to mention prefabricated controls, e.g. with horizontal or vertical 
> layout.

I don't understand what you mean here.

Michael.




More information about the Lazarus mailing list