Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-01

AnchorSide clarification

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans-Peter Diettrich

The FPDoc description of TAnchorSide looks wrong to me. 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]

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

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]

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.

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.

Lazarus adds another anchoring method to beforementioned Delphi compatible anchoring:

AnchorSides[] allow to anchor the control to other controls (siblings only?).
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.

DoDi

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich
The FPDoc description of TAnchorSide looks wrong to me.

I improved it.

Show quoted text 9 lines
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.

Show quoted text 6 lines
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.

Show quoted text 7 lines
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.

Show quoted text 5 lines
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

Reply by email

Hans-Peter Diettrich
to Mattias Gaertner
Show quoted text 6 lines
On Sat, 01 Jan 2011 14:28:08 +0100 Hans-Peter Diettrich wrote: > The FPDoc description of TAnchorSide looks wrong to me. I improved it.

Thanks :-)

Examples are nice, but only usable online. Since I'm offline most of the time now, I found the FPDoc descriptions almost wrong or otherwse unusable, both in the source code and the XML files. IMO we should have some QC for the documentation, or else it's only a waste of time to fill it with meaningless or wrong information.

DoDi

Reply by email