Hi,
There are some ambigious things in the autoresizing of the VCL and LCL and so I want to define/discuss them.
Aligning and anchoring are the main parts of the LCL automatic child positioning and resizing. Other factors like constraints, AdjustClientRect, control order, scaling, loading process, user defined resizes, themes, interface specials, ... makes the automatic resizing a very complex process. And of course the current properties are not sufficient. On my wishlist are gaps, connected controls and aligning controls and I guess there are people with more wishes. And last but not least we should try to keep VCL compatibility.
For the compatibility: It is clear, we will never achieve 100%. Some of the VCL controls uses some win32 specific tricks, which not all widgets of all interfaces support. And LCL applications should "work" the same with all interfaces. "Work" does neither mean look nor size. The Delphi help is ambigious at this place and does not describe the whole behaviour. Therefore we need definitions, how the automatic resizing should work.
Anchors:
- combinations of akLeft/akRight with akTop/akBottom are independent
- [akLeft] - try to keep "Left". This means, try to keep the distance of the left border of the control and the left border of the client area of the parent. If Align=alRight, then the "Width" will be adjusted, when the parent is resized. The LCL tries to keep the last user defined "Left". So, it will use the "Left" after loading, but not during loading, it will use the "Left" of a SetBounds, but not the Left from a size message from the interface and not the Left of the automatic resizing.
The same for [akRight], [akTop], [akBottom].
- [akLeft,akRight] will try to keep both, the left and right distance by adjusting the width.
The same for [akTop,akBottom].
- [] will try to keep the width(height) and center the control.
- The minimum Width and Height is 0.
Align:
alLeft - try to keep "Width", try to set "Left" to the left edge of the remaining client area, try to set "Top" to the top edge and "Width" to the width of the remaining client area. The kept "Left" is the same as under Anchors.
Same for alRight, alBottom, alTop.
After the aligning, the remaining client area is reduced. alClient - As above, with the exception that the VCL does almost never reduce. Therefore two controls with alClient will overlapp. The LCL never reduce the client area on alClient. I thought, this was a bug, till Michas mail.
The VCL has some exceptions to this rules. But they are not mentioned in the Delphi Help and most of them exists because some of the VCL controls do not cleanly distinguish between client area and bounds.
Mattias