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
function AutoSizePhases: TControlAutoSizePhases; virtual;
function AutoSizeDelayed: boolean; virtual;
function AutoSizeDelayedReport: string; virtual;
function AutoSizeDelayedHandle: Boolean; virtual;
procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer;
Sibling: TControl);
@ -2099,6 +2100,7 @@ type
// size, position, bounds
function AutoSizePhases: TControlAutoSizePhases; override;
function AutoSizeDelayed: boolean; override;
function AutoSizeDelayedReport: string; override;
function AutoSizeDelayedHandle: Boolean; override;
procedure BeginUpdateBounds; // disable SetBounds
procedure EndUpdateBounds; // enable SetBounds

View File

@ -2983,6 +2983,26 @@ begin
{$ENDIF}
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

View File

@ -2610,10 +2610,10 @@ end;
procedure TCustomForm.UpdateShowing;
begin
if csLoading in ComponentState then exit;
{$IFDEF CHECK_POSITION}
DebugLn('[TCustomForm.UpdateShowing] A ',DbgSName(Self),' Pos=',DbgS(Left),',',DbgS(Top),' Visible=',DbgS(Visible));
{$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
DebugLn(['[TCustomForm.UpdateShowing] STAR ',DbgSName(Self),' Pos=',Left,',',Top,' Visible=',Visible,' Showing=',Showing]);
{$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
begin
if not (csDesigning in ComponentState) then
@ -2624,12 +2624,12 @@ begin
DoFirstShow;
end;
end;
{$IFDEF CHECK_POSITION}
DebugLn('[TCustomForm.UpdateShowing] B ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top));
{$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
DebugLn(['[TCustomForm.UpdateShowing] calling inherited ',dbgsname(Self),' Pos=',Left,',',Top]);
{$ENDIF}
inherited UpdateShowing;
{$IFDEF CHECK_POSITION}
DebugLn('[TCustomForm.UpdateShowing] END ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top));
{$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
DebugLn(['[TCustomForm.UpdateShowing] activating ',dbgsname(Self),' Pos=',Left,',',Top]);
{$ENDIF}
// activate focus if visible
if Showing and (not (csDestroying in ComponentState)) then

View File

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