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