[Lazarus] AlignControls

Juha Manninen juha.manninen62 at gmail.com
Fri Feb 1 11:56:28 CET 2013


I am trying to figure out how AlignControls works.
The signature is:

  procedure AlignControls(aControl: TControl; var aRect: TRect); override;

What exactly is aControl for? Delphi's documentation says:
AControl specifies the control that takes precedence in alignment when
other controls have the same Align value. AControl can be nil

Does it mean AControl is Nil when all controls have Align = alNone?
The base method TWinControl.AlignControls is huge, over 700 lines,
made by "ask".

There is an error in wiki page:
 http://wiki.freepascal.org/Autosize_/_Layout
which says:
The layout is applied in the method TWinControl.AlignControls which
can be overridden. For example TToolBar overrides that and defines a
flow layout where controls that do not fit are put into subsequent
lines.

However, TToolBar does not have such method.
There are only 2 components with overridden AlignControls,
TScrollingWinControl where it only updates scrollbars, and TControlBar
where is does nothing yet.

I am thinking how to use it in TControlBar and maybe in TCoolBar.
As you can see I am not very experienced component writer.

Regards,
Juha




More information about the Lazarus mailing list