mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 14:09:31 +02:00
fix defocus control when destroying it
git-svn-id: trunk@4943 -
This commit is contained in:
parent
8a4aa2f26c
commit
d67aaa19bf
@ -1023,6 +1023,7 @@ type
|
||||
Procedure CMDrag(var Message : TCMDrag); message CM_DRAG;
|
||||
procedure CMShowingChanged(var Message: TLMessage); message CM_SHOWINGCHANGED;
|
||||
procedure CMVisibleChanged(var TheMessage: TLMessage); message CM_VISIBLECHANGED;
|
||||
function ContainsControl(Control: TControl): Boolean;
|
||||
procedure ControlsAligned; virtual;
|
||||
procedure DoSendBoundsToInterface; virtual;
|
||||
procedure RealizeBounds; virtual;
|
||||
@ -1852,6 +1853,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.160 2003/12/23 16:50:45 micha
|
||||
fix defocus control when destroying it
|
||||
|
||||
Revision 1.159 2003/12/14 19:18:03 micha
|
||||
hint fixes: parentfont, font itself, showing/hiding + more
|
||||
|
||||
|
@ -431,6 +431,7 @@ type
|
||||
procedure ShowOnTop;
|
||||
function WantChildKey(Child : TControl;
|
||||
var Message : TLMessage): Boolean; virtual;
|
||||
procedure DefocusControl(Control: TWinControl; Removing: Boolean);
|
||||
procedure SetFocus; override;
|
||||
function SetFocusedControl(Control: TWinControl): Boolean ; Virtual;
|
||||
procedure FocusControl(WinControl: TWinControl);
|
||||
|
@ -457,6 +457,20 @@ begin
|
||||
inherited WMSize(Message);
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomForm.DefocusControl
|
||||
Params: Control: the control which is to be defocused
|
||||
Removing: is it to be defocused because it is being removed?
|
||||
Returns: nothing
|
||||
|
||||
Updates ActiveControl if it is to be defocused
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomForm.DefocusControl(Control: TWinControl; Removing: Boolean);
|
||||
begin
|
||||
if Control.ContainsControl(FActiveControl) then
|
||||
ActiveControl := nil;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomForm.DoCreate
|
||||
Params: none
|
||||
@ -1453,6 +1467,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.122 2003/12/23 16:50:45 micha
|
||||
fix defocus control when destroying it
|
||||
|
||||
Revision 1.121 2003/12/18 08:50:13 micha
|
||||
attachmenutowindow cleanup
|
||||
|
||||
|
@ -2045,7 +2045,7 @@ var
|
||||
Form: TCustomForm;
|
||||
begin
|
||||
Form := GetParentForm(Self);
|
||||
if Form <> nil then ;//Form.DefocusControl(Self, Removing);
|
||||
if Form <> nil then Form.DefocusControl(Self, Removing);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -2155,6 +2155,19 @@ begin
|
||||
end;
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TWinControl.ContainsControl
|
||||
Params: Control: the control to be checked
|
||||
Returns: Self is a (super)parent of Control
|
||||
|
||||
Checks if Control is a child of Self
|
||||
------------------------------------------------------------------------------}
|
||||
function TWinControl.ContainsControl(Control: TControl): Boolean;
|
||||
begin
|
||||
while (Control <> nil) and (Control <> Self) do Control := Control.Parent;
|
||||
Result := Control = Self;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TWinControl GetBrush
|
||||
------------------------------------------------------------------------------}
|
||||
@ -2279,6 +2292,9 @@ var
|
||||
Control: TControl;
|
||||
begin
|
||||
//writeln('[TWinControl.Destroy] A ',Name,':',ClassName);
|
||||
// prevent parent to try to focus a to be destroyed control
|
||||
if Parent <> nil then
|
||||
RemoveFocus(true);
|
||||
if HandleAllocated then
|
||||
DestroyHandle;
|
||||
//writeln('[TWinControl.Destroy] B ',Name,':',ClassName);
|
||||
@ -3150,6 +3166,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.182 2003/12/23 16:50:45 micha
|
||||
fix defocus control when destroying it
|
||||
|
||||
Revision 1.181 2003/12/14 19:18:04 micha
|
||||
hint fixes: parentfont, font itself, showing/hiding + more
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user