LCL: added heutistic for missing ClientWidth/ClientHeight in lfm

git-svn-id: trunk@13041 -
This commit is contained in:
mattias 2007-11-26 20:29:11 +00:00
parent d815ea8ea2
commit d6c8262c2a
2 changed files with 17 additions and 10 deletions

View File

@ -2250,10 +2250,8 @@ end;
procedure TControl.SetClientHeight(Value: Integer);
begin
if csLoading in ComponentState then begin
{$IFNDEF DisableLoadedClientSize}
FLoadedClientSize.Y:=Value;
Include(FControlFlags,cfClientHeightLoaded);
{$ENDIF}
end else begin
// during loading the ClientHeight is not used to set the Height of the
// control, but only to restore autosizing. For example Anchors=[akBottom]
@ -2280,10 +2278,8 @@ end;
procedure TControl.SetClientWidth(Value: Integer);
begin
if csLoading in ComponentState then begin
{$IFNDEF DisableLoadedClientSize}
FLoadedClientSize.X:=Value;
Include(FControlFlags,cfClientWidthLoaded);
{$ENDIF}
end else begin
// during loading the ClientWidth is not used to set the Width of the
// control, but only to restore autosizing. For example Anchors=[akRight]

View File

@ -6608,6 +6608,7 @@ var
i: Integer;
AChild: TControl;
LoadedClientSize: TPoint;
CurControl: TWinControl;
begin
DisableAlign;
DisableAutoSizing;
@ -6616,16 +6617,26 @@ begin
if cfClientWidthLoaded in FControlFlags then
LoadedClientSize.X:=FLoadedClientSize.X
else begin
LoadedClientSize.X:=ClientWidth;
if LoadedClientSize.X<=0 then
LoadedClientSize.X:=Width;
CurControl:=Self;
while CurControl<>nil do begin
LoadedClientSize.X:=CurControl.ClientWidth;
if LoadedClientSize.X>0 then break;
LoadedClientSize.X:=CurControl.Width;
if LoadedClientSize.X>0 then break;
CurControl:=CurControl.Parent;
end;
end;
if cfClientHeightLoaded in FControlFlags then
LoadedClientSize.Y:=FLoadedClientSize.Y
else begin
LoadedClientSize.Y:=ClientHeight;
if LoadedClientSize.Y<=0 then
LoadedClientSize.Y:=Height;
CurControl:=Self;
while CurControl<>nil do begin
LoadedClientSize.Y:=CurControl.ClientHeight;
if LoadedClientSize.Y>0 then break;
LoadedClientSize.Y:=CurControl.Height;
if LoadedClientSize.Y>0 then break;
CurControl:=CurControl.Parent;
end;
end;
for i:=0 to ControlCount-1 do begin
AChild:=Controls[i];