Hello,
After the recent AutoSize fixes of Mattias, easy docking with default LCL code
is in sight.
I do propose the following fix for TControl.DoDock:
Change
// adjust new bounds, so that they at least fit into the client area of
// its parent
LCLProc.MoveRectToFit(ARect, NewDockSite.GetLogicalClientRect)
To
// adjust new bounds, so that they at least fit into the client area of
// its parent
IF not NewDockSite.AutoSize then
LCLProc.MoveRectToFit(ARect, NewDockSite.GetLogicalClientRect)
else
ARect:=Rect(0,0,Width,Height);
Rationale:
If the new dock site has AutoSize set to 'True', then it should adapt
itself to the control to be docked, and not vice versa. So the rectangle
should be set to the current size of the control.
Maybe the rectangle can be improved to take into account alignment:
else
case align of
alLeft,
alRight : ARect:=Rect(0,0,Width,NewDockSite.ClientHeight)
alTop,
alBottom : ARect:=Rect(0,0,NewDockSite.ClientWidth,Height)
else
ARect:=Rect(0,0,Width,Height);
end;
Applying this gives markedly better results.
What should happen if the docked control has Align=AlClient and the
dock host control has AutoSize=True, is still a source of mystery to me :)
Michael.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus