mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:59:17 +02:00
LCL: debugging
git-svn-id: trunk@26501 -
This commit is contained in:
parent
81f8e13285
commit
b37ad612d8
@ -451,13 +451,7 @@ end;
|
||||
procedure TCustomForm.WMShowWindow(var message: TLMShowWindow);
|
||||
begin
|
||||
{$IFDEF VerboseFocus}
|
||||
DbgOut('TCustomForm.WMShowWindow A ',Name,':'+ClassName+' fsShowing='+dbgs(fsShowing in FFormState)+' Msg.Show='+dbgs(Message.Show));
|
||||
if FActiveControl<>nil then begin
|
||||
DbgOut(' FActiveControl=',FActiveControl.Name,':',FActiveControl.ClassName,' HandleAllocated=',dbgs(FActiveControl.HandleAllocated));
|
||||
end else begin
|
||||
DbgOut(' FActiveControl=nil');
|
||||
end;
|
||||
DebugLn('');
|
||||
Debugln(['TCustomForm.WMShowWindow A ',DbgSName(Self),' fsShowing=',fsShowing in FFormState,' Msg.Show=',Message.Show,' FActiveControl=',DbgSName(FActiveControl)]);
|
||||
{$ENDIF}
|
||||
if (fsShowing in FFormState) then exit;
|
||||
Include(FFormState, fsShowing);
|
||||
@ -483,7 +477,7 @@ end;
|
||||
procedure TCustomForm.WMActivate(var Message : TLMActivate);
|
||||
begin
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.WMActivate A ',Name,':',ClassName,' Msg.Active=',dbgs(Message.Active));
|
||||
DebugLn('TCustomForm.WMActivate A ',DbgSName(Self),' Msg.Active=',dbgs(Message.Active));
|
||||
{$ENDIF}
|
||||
if (FormStyle <> fsMDIForm) or (csDesigning in ComponentState) then
|
||||
SetActive(Message.Active);
|
||||
@ -1708,8 +1702,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomForm.SetActiveControl(AWinControl: TWinControl);
|
||||
begin
|
||||
if FActiveControl <> AWinControl then
|
||||
begin
|
||||
if FActiveControl = AWinControl then exit;
|
||||
if (AWinControl<>nil) and IsVisible then
|
||||
begin
|
||||
// this form can focus => do some sanity checks and raise an exception to
|
||||
@ -1731,15 +1724,7 @@ begin
|
||||
end;
|
||||
|
||||
{$IFDEF VerboseFocus}
|
||||
DbgOut('TCustomForm.SetActiveControl ',Name,':',ClassName,' FActive=',DbgS(FActive));
|
||||
if FActiveControl<>nil then
|
||||
DebugLn(' OldActiveControl=',DbgSName(FActiveControl))
|
||||
else
|
||||
DebugLn(' OldActiveControl=nil');
|
||||
if AWinControl<>nil then
|
||||
DebugLn(' NewActiveControl=',DbgSName(AWinControl))
|
||||
else
|
||||
DebugLn(' NewActiveControl=nil');
|
||||
Debugln(['TCustomForm.SetActiveControl ',DbgSName(Self),' FActive=',DbgS(FActive),' OldActiveControl=',DbgSName(FActiveControl),' NewActiveControl=',DbgSName(AWinControl)]);
|
||||
{$ENDIF}
|
||||
|
||||
FActiveControl := AWinControl;
|
||||
@ -1750,7 +1735,6 @@ begin
|
||||
SetWindowFocus;
|
||||
ActiveChanged;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.SetActiveDefaultControl(AControl: TControl);
|
||||
@ -2261,12 +2245,21 @@ begin
|
||||
if (FDesigner = nil) and (not (csLoading in ComponentState)) then
|
||||
begin
|
||||
if Control <> Self then begin
|
||||
{$IFDEF VerboseFocus}
|
||||
if FActiveControl<>Control then
|
||||
debugln(['TCustomForm.SetFocusedControl ',DbgSName(Self),' OldActiveControl=',DbgSName(FActiveControl),' New=',DbgSName(Control)]);
|
||||
{$ENDIF}
|
||||
FActiveControl := Control;
|
||||
if FActiveControl<>nil then
|
||||
FreeNotification(FActiveControl);
|
||||
end else
|
||||
end else begin
|
||||
{$IFDEF VerboseFocus}
|
||||
if FActiveControl<>nil then
|
||||
debugln(['TCustomForm.SetFocusedControl ',DbgSName(Self),' OldActiveControl=',DbgSName(FActiveControl),' New=',DbgSName(Control)]);
|
||||
{$ENDIF}
|
||||
FActiveControl := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// update Screen object
|
||||
Screen.FActiveControl := Control;
|
||||
@ -2299,6 +2292,10 @@ begin
|
||||
while CurControl <> nil do
|
||||
begin
|
||||
if CurControl is TCustomForm then begin
|
||||
{$IFDEF VerboseFocus}
|
||||
if TCustomForm(CurControl).FActiveControl<>Control then
|
||||
debugln(['TCustomForm.SetFocusedControl Self=',DbgSName(Self),' SomeParent=',DbgSName(CurControl),' OldActiveControl=',DbgSName(TCustomForm(CurControl).FActiveControl),' New=',DbgSName(Control)]);
|
||||
{$ENDIF}
|
||||
TCustomForm(CurControl).FActiveControl := Control;
|
||||
TCustomForm(CurControl).FreeNotification(Control);
|
||||
end;
|
||||
@ -2478,8 +2475,11 @@ begin
|
||||
end;
|
||||
if (ActiveControl <> nil) and (Parent=nil) then
|
||||
begin
|
||||
// check if loaded ActiveControl can be focused
|
||||
// and if yes, call SetActiveControl to invoke handlers
|
||||
Control := ActiveControl;
|
||||
{$IFDEF VerboseFocus}
|
||||
if FActiveControl<>nil then
|
||||
Debugln('TCustomForm.Loaded Self=',DbgSName(Self),' FActiveControl=',DbgSName(FActiveControl));
|
||||
{$ENDIF}
|
||||
FActiveControl := nil;
|
||||
|
Loading…
Reference in New Issue
Block a user