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

View File

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