[Lazarus] AnchorSide clarification

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jan 6 19:32:48 CET 2011


On Sat, 01 Jan 2011 14:28:08 +0100
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> The FPDoc description of TAnchorSide looks wrong to me. 

I improved it.

> IMO it should 
> reflect the following:
> 
> Every side of a TControl can be anchored to another control, as 
> described by TControl.AnchorSides[side].
> 
> TAnchorSide.Owner is the control *to be* anchored.
> [should read: Control]
> [ctrl.AnchorSide[side].Owner = ctrl]

True.

 
> TAnchorSide.Kind is the control side (index in AnchorSides).
> [should read: ControlSide]
> [ctrl.AnchorSide[side].Kind = side]

Yes.

 
> TAnchorSide.Control is the anchor control,
> [should read: AnchorControl]
> 
> and TAnchorSide.Side is the side of that control, *to* which Owner is 
> anchored or aligned (plus asrCenter).
> [should read: AlignTo]

Yes, although 'aligned' can be confused with the Align property, so I
avoid this in this context.

 
> If this is correct, the FPDoc should be updated accordingly.
> 
> 
> This is how IMO a control can be anchored:
> 
> Normally the TControl.Top/Left is the absolute control origin within its 
> Parent, Width/Height is the absolute extent (size) of the control.

... within its Parent client area, ...


> The sides of a control can be anchored to its Parent (ClientRect) sides, 
> as specified by TControl.Anchors. For every such anchored side the 
> distance to the Parent.ClientRect is preserved when the Parent is resized.

Yes.

 
> Lazarus adds another anchoring method to beforementioned Delphi 
> compatible anchoring:
> 
> AnchorSides[] allow to anchor the control to other controls (siblings 
> only?).

Siblings and Parent.


> For every side a TAnchorSide object can specify the control and its 
> side, to which the control's side is anchored. For every such anchored 
> side the distance to the anchor control is preserved, as specified in 
> the control's BorderSpacing.

yes.
This is explained with examples here:
http://wiki.lazarus.freepascal.org/Autosize_/_Layout#Anchor_Sides


Mattias




More information about the Lazarus mailing list