LCL: call UpdateShowing for top level control outside autosize loop, needed for Form moves in Form.OnShow, bug #16087

git-svn-id: trunk@24662 -
This commit is contained in:
mattias 2010-04-17 13:09:02 +00:00
parent 1446a85067
commit 7b1b83e91a

View File

@ -3445,7 +3445,8 @@ procedure TWinControl.DoAllAutoSize;
ClearRequests(TWinControl(AControl).Controls[i]); ClearRequests(TWinControl(AControl).Controls[i]);
end; end;
procedure UpdateShowingRecursive(AWinControl: TWinControl); procedure UpdateShowingRecursive(AWinControl: TWinControl;
OnlyChilds: boolean);
var var
i: Integer; i: Integer;
begin begin
@ -3453,9 +3454,9 @@ procedure TWinControl.DoAllAutoSize;
if AWinControl.FControls<>nil then if AWinControl.FControls<>nil then
for i:=0 to AWinControl.FControls.Count-1 do for i:=0 to AWinControl.FControls.Count-1 do
if TObject(AWinControl.FControls[i]) is TWinControl then if TObject(AWinControl.FControls[i]) is TWinControl then
UpdateShowingRecursive(TWinControl(AWinControl.FControls[i])); UpdateShowingRecursive(TWinControl(AWinControl.FControls[i]),false);
// then make the control visible // then make the control visible
if AWinControl.HandleObjectShouldBeVisible if (not OnlyChilds) and AWinControl.HandleObjectShouldBeVisible
and (not AWinControl.Showing) then and (not AWinControl.Showing) then
AWinControl.UpdateShowing; AWinControl.UpdateShowing;
end; end;
@ -3497,13 +3498,13 @@ begin
{$ENDIF} {$ENDIF}
RealizeBoundsRecursive; RealizeBoundsRecursive;
if (cfAutoSizeNeeded in FControlFlags) then continue; // repeat computing bounds if (cfAutoSizeNeeded in FControlFlags) then continue; // repeat computing bounds
// make handles visible // make child handles visible
{$IFDEF VerboseAllAutoSize} {$IFDEF VerboseAllAutoSize}
DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]);
{$ENDIF} {$ENDIF}
Include(FWinControlFlags,wcfUpdateShowing); Include(FWinControlFlags,wcfUpdateShowing);
try try
UpdateShowingRecursive(Self); UpdateShowingRecursive(Self,true);
finally finally
Exclude(FWinControlFlags,wcfUpdateShowing); Exclude(FWinControlFlags,wcfUpdateShowing);
end; end;
@ -3516,6 +3517,17 @@ begin
finally finally
Exclude(FWinControlFlags,wcfAllAutoSizing); Exclude(FWinControlFlags,wcfAllAutoSizing);
end; end;
// make handle visible => this can trigger events like Form.OnShow where
// application do arbitrary stuff
{$IFDEF VerboseAllAutoSize}
DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]);
{$ENDIF}
Include(FWinControlFlags,wcfUpdateShowing);
try
UpdateShowingRecursive(Self,false);
finally
Exclude(FWinControlFlags,wcfUpdateShowing);
end;
end; end;
procedure TWinControl.AllAutoSized; procedure TWinControl.AllAutoSized;