LCL: childsizing: fixed using top/left spacing of middle controls on grid, bug #20383

git-svn-id: trunk@32589 -
This commit is contained in:
mattias 2011-10-01 17:16:24 +00:00
parent cc95515d35
commit eb25db0014

View File

@ -1706,6 +1706,7 @@ var
i: Integer; i: Integer;
Child: TAutoSizeBox; Child: TAutoSizeBox;
CurLeftTop: Integer; CurLeftTop: Integer;
s: LongInt;
begin begin
CurLeftTop:=0; CurLeftTop:=0;
for i:=0 to ChildCount[Orientation]-1 do begin for i:=0 to ChildCount[Orientation]-1 do begin
@ -1714,7 +1715,10 @@ begin
inc(CurLeftTop,Child.BorderLeftTop[Orientation]); inc(CurLeftTop,Child.BorderLeftTop[Orientation]);
Child.LeftTop[Orientation]:=CurLeftTop; Child.LeftTop[Orientation]:=CurLeftTop;
inc(CurLeftTop,Child.PreferredSize[Orientation]); inc(CurLeftTop,Child.PreferredSize[Orientation]);
inc(CurLeftTop,Child.BorderRightBottom[Orientation]); s:=Child.BorderRightBottom[Orientation];
if i<ChildCount[Orientation]-1 then
s:=Max(s,Children[Orientation][i+1].BorderLeftTop[Orientation]);
inc(CurLeftTop,s);
end; end;
end; end;
@ -1735,6 +1739,7 @@ var
var var
i: Integer; i: Integer;
Child: TAutoSizeBox; Child: TAutoSizeBox;
s: LongInt;
begin begin
Result:=0; Result:=0;
for i:=0 to ChildCount[Orientation]-1 do begin for i:=0 to ChildCount[Orientation]-1 do begin
@ -1744,7 +1749,10 @@ var
if Child.PreferredSize[Orientation]<1 then if Child.PreferredSize[Orientation]<1 then
Child.PreferredSize[Orientation]:=1; Child.PreferredSize[Orientation]:=1;
inc(Result,Child.PreferredSize[Orientation]); inc(Result,Child.PreferredSize[Orientation]);
inc(Result,Child.BorderRightBottom[Orientation]); s:=Child.BorderRightBottom[Orientation];
if i<ChildCount[Orientation]-1 then
s:=Max(s,Children[Orientation][i+1].BorderLeftTop[Orientation]);
inc(Result,s);
end; end;
end; end;