[Lazarus] Proposal for TControl.DoDock patch
Michael Van Canneyt
michael at freepascal.org
Mon Apr 5 22:13:11 CEST 2010
On Mon, 5 Apr 2010, Hans-Peter Diettrich wrote:
> Michael Van Canneyt schrieb:
>
>> I have been thinking about layout managers. I think that this should be an
>> add-on
>> to the currently existing layouting (to preserve delphi compatibility): I
>> imagine a component that one drops on a form. One sets the 'target' control
>> (control whose children should be managed) and some properties.
>
> I imagine a Layout property for TWinControls, or an intermediate layer, that
> is initialized to the Delphi compatible manager. That property then can be
> assigned any other layout manager.
That is the same as what I am saying, only the arrow points in the opposite
direction. I want to avoid this extra TWinControl property.
>> The only thing I am unsure about is whether TControl should be made
>> TLayout-aware.
>> As far as I understand, a layouter only needs to be able to handle
>> rectangles,
>> within some restrictions (some callbacks to get min/max rectangles). It
>> need not know anything about TControl or it's properties, and as such could
>> be implemented totally independent of the LCL.
>
> The layout should take into account the standard TControl properties,
> including alignment, constraints and anchors. It also should use the layout
> managers of child controls, for forward/backward transfer of autosize
> information.
This is *exactly* what I want to avoid.
- Either one uses the 'ordinary' delphi properties, and only those.
- Or one uses layouters.
But not a mixture of both, which will be a source of implementation/usage
problems and confusion. Keep it simple.
Once this split works correctly, you can always later try to create a
TLayout descendent which tries to mimic Delphi behaviour, taking into
account all TControl/TWincontrol properties; Then remove all old code
and insert the new layouter.
In my opinion, this approach guarantees has a bigger chance of success
than immediatly trying to do everything at once...
Michael.
More information about the Lazarus
mailing list