LCL: more verbose form updateshowing

git-svn-id: trunk@36385 -
This commit is contained in:
mattias 2012-03-27 16:27:45 +00:00
parent af0c29f995
commit 47c24e80ad
4 changed files with 47 additions and 12 deletions

View File

@ -1434,6 +1434,7 @@ type
procedure AdjustSize; virtual;// smart calling DoAutoSize procedure AdjustSize; virtual;// smart calling DoAutoSize
function AutoSizePhases: TControlAutoSizePhases; virtual; function AutoSizePhases: TControlAutoSizePhases; virtual;
function AutoSizeDelayed: boolean; virtual; function AutoSizeDelayed: boolean; virtual;
function AutoSizeDelayedReport: string; virtual;
function AutoSizeDelayedHandle: Boolean; virtual; function AutoSizeDelayedHandle: Boolean; virtual;
procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer; procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer;
Sibling: TControl); Sibling: TControl);
@ -2099,6 +2100,7 @@ type
// size, position, bounds // size, position, bounds
function AutoSizePhases: TControlAutoSizePhases; override; function AutoSizePhases: TControlAutoSizePhases; override;
function AutoSizeDelayed: boolean; override; function AutoSizeDelayed: boolean; override;
function AutoSizeDelayedReport: string; override;
function AutoSizeDelayedHandle: Boolean; override; function AutoSizeDelayedHandle: Boolean; override;
procedure BeginUpdateBounds; // disable SetBounds procedure BeginUpdateBounds; // disable SetBounds
procedure EndUpdateBounds; // enable SetBounds procedure EndUpdateBounds; // enable SetBounds

View File

@ -2983,6 +2983,26 @@ begin
{$ENDIF} {$ENDIF}
end; end;
function TControl.AutoSizeDelayedReport: string;
begin
if (FAutoSizingLockCount>0) then
Result:='FAutoSizingLockCount='+dbgs(FAutoSizingLockCount)
else if csLoading in ComponentState then
Result:='csLoading'
else if csDestroying in ComponentState then
Result:='csDestroying'
else if cfLoading in FControlFlags then
Result:='cfLoading'
else if IsControlVisible then
Result:='not IsControlVisible'
else if AutoSizeDelayedHandle then
Result:='AutoSizeDelayedHandle'
else if Parent<>nil then
Result:=Parent.AutoSizeDelayedReport
else
Result:='?';
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TControl AutoSizeDelayedHandle TControl AutoSizeDelayedHandle

View File

@ -2610,10 +2610,10 @@ end;
procedure TCustomForm.UpdateShowing; procedure TCustomForm.UpdateShowing;
begin begin
if csLoading in ComponentState then exit; if csLoading in ComponentState then exit;
{$IFDEF CHECK_POSITION} {$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
DebugLn('[TCustomForm.UpdateShowing] A ',DbgSName(Self),' Pos=',DbgS(Left),',',DbgS(Top),' Visible=',DbgS(Visible)); DebugLn(['[TCustomForm.UpdateShowing] STAR ',DbgSName(Self),' Pos=',Left,',',Top,' Visible=',Visible,' Showing=',Showing]);
{$ENDIF} {$ENDIF}
{ If the the form is about to show, calculate its metrics } // If the the form is about to show, calculate its metrics
if Visible and (not (csDestroying in ComponentState)) then if Visible and (not (csDestroying in ComponentState)) then
begin begin
if not (csDesigning in ComponentState) then if not (csDesigning in ComponentState) then
@ -2624,12 +2624,12 @@ begin
DoFirstShow; DoFirstShow;
end; end;
end; end;
{$IFDEF CHECK_POSITION} {$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
DebugLn('[TCustomForm.UpdateShowing] B ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top)); DebugLn(['[TCustomForm.UpdateShowing] calling inherited ',dbgsname(Self),' Pos=',Left,',',Top]);
{$ENDIF} {$ENDIF}
inherited UpdateShowing; inherited UpdateShowing;
{$IFDEF CHECK_POSITION} {$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
DebugLn('[TCustomForm.UpdateShowing] END ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top)); DebugLn(['[TCustomForm.UpdateShowing] activating ',dbgsname(Self),' Pos=',Left,',',Top]);
{$ENDIF} {$ENDIF}
// activate focus if visible // activate focus if visible
if Showing and (not (csDestroying in ComponentState)) then if Showing and (not (csDestroying in ComponentState)) then

View File

@ -2387,6 +2387,14 @@ begin
{$ENDIF} {$ENDIF}
end; end;
function TWinControl.AutoSizeDelayedReport: string;
begin
if csDestroyingHandle in ControlState then
Result:='csDestroyingHandle'
else
Result:=inherited AutoSizeDelayedReport;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TWinControl AutoSizeDelayedHandle TWinControl AutoSizeDelayedHandle
@ -3308,7 +3316,7 @@ begin
{$ENDIF} {$ENDIF}
if not (caspComputingBounds in AutoSizePhases) then begin if not (caspComputingBounds in AutoSizePhases) then begin
{$IFDEF VerboseAllAutoSize} {$IFDEF VerboseAllAutoSize}
DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizePhase=',AutoSizePhaseNames[AutoSizePhase]]); DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizePhases=',dbgs(AutoSizePhases)]);
{$ENDIF} {$ENDIF}
AdjustSize; AdjustSize;
exit; exit;
@ -3505,7 +3513,7 @@ begin
inc(UpdateShowingCounter); inc(UpdateShowingCounter);
// make child handles visible // make child handles visible
{$IFDEF VerboseAllAutoSize} {$IFDEF VerboseAllAutoSize}
DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING children ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]);
{$ENDIF} {$ENDIF}
Include(FWinControlFlags,wcfUpdateShowing); Include(FWinControlFlags,wcfUpdateShowing);
try try
@ -3525,14 +3533,19 @@ begin
// make handle visible => this can trigger events like Form.OnShow where // make handle visible => this can trigger events like Form.OnShow where
// application does arbitrary stuff // application does arbitrary stuff
{$IFDEF VerboseAllAutoSize} {$IFDEF VerboseAllAutoSize}
DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING self ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]);
{$ENDIF} {$ENDIF}
if not (wcfUpdateShowing in FWinControlFlags) then if not (wcfUpdateShowing in FWinControlFlags) then
begin begin
Include(FWinControlFlags, wcfUpdateShowing); Include(FWinControlFlags, wcfUpdateShowing);
try try
if HandleObjectShouldBeVisible and not Showing then if HandleObjectShouldBeVisible and not Showing then
UpdateShowing; UpdateShowing
else begin
{$IFDEF VerboseAllAutoSize}
DebugLn(['TWinControl.DoAllAutoSize not UPDATESHOWING self ',DbgSName(Self),' because HandleObjectShouldBeVisible=',HandleObjectShouldBeVisible,' Showing=',Showing]);
{$ENDIF}
end;
finally finally
Exclude(FWinControlFlags, wcfUpdateShowing); Exclude(FWinControlFlags, wcfUpdateShowing);
end; end;
@ -4310,7 +4323,7 @@ begin
if AutoSizeDelayed or (not (caspShowing in AutoSizePhases)) then if AutoSizeDelayed or (not (caspShowing in AutoSizePhases)) then
begin begin
{$IFDEF VerboseShowing} {$IFDEF VerboseShowing}
if AutoSizeDelayed then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because AutoSizeDelayed']); if AutoSizeDelayed then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because AutoSizeDelayed: ',AutoSizeDelayedReport]);
if (not (caspShowing in AutoSizePhases)) then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because wrong phase']); if (not (caspShowing in AutoSizePhases)) then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because wrong phase']);
{$ENDIF} {$ENDIF}
exit; exit;