mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-23 02:08:20 +02:00
lcl: clear FActiveDefaultControl on that control destruction (based on patch of David Jenkins, issue #0021735)
git-svn-id: trunk@36806 -
This commit is contained in:
parent
62cc1885af
commit
a34725fc50
@ -262,6 +262,8 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FActiveControl := nil;
|
FActiveControl := nil;
|
||||||
end;
|
end;
|
||||||
|
if AComponent = FActiveDefaultControl then
|
||||||
|
FActiveDefaultControl := nil;
|
||||||
if AComponent = FDefaultControl then
|
if AComponent = FDefaultControl then
|
||||||
FDefaultControl := nil;
|
FDefaultControl := nil;
|
||||||
if AComponent = FCancelControl then
|
if AComponent = FCancelControl then
|
||||||
@ -269,7 +271,7 @@ begin
|
|||||||
if AComponent = FLastFocusedControl then
|
if AComponent = FLastFocusedControl then
|
||||||
FLastFocusedControl := nil;
|
FLastFocusedControl := nil;
|
||||||
// then do stuff which can trigger things
|
// then do stuff which can trigger things
|
||||||
if (FActionLists <> nil) and (AComponent is TCustomActionList) then
|
if Assigned(FActionLists) and (AComponent is TCustomActionList) then
|
||||||
DoRemoveActionList(TCustomActionList(AComponent))
|
DoRemoveActionList(TCustomActionList(AComponent))
|
||||||
else
|
else
|
||||||
if AComponent = Menu then
|
if AComponent = Menu then
|
||||||
@ -1840,11 +1842,14 @@ begin
|
|||||||
lPrevControl := FActiveDefaultControl;
|
lPrevControl := FActiveDefaultControl;
|
||||||
FActiveDefaultControl := AControl;
|
FActiveDefaultControl := AControl;
|
||||||
|
|
||||||
|
if Assigned(FActiveDefaultControl) then
|
||||||
|
FActiveDefaultControl.FreeNotification(Self);
|
||||||
|
|
||||||
// notify previous active default control that he has lost "default-ness"
|
// notify previous active default control that he has lost "default-ness"
|
||||||
if lPrevControl <> nil then
|
if Assigned(lPrevControl) then
|
||||||
lPrevControl.ActiveDefaultControlChanged(AControl);
|
lPrevControl.ActiveDefaultControlChanged(AControl);
|
||||||
// notify default control that it may become/lost active default again
|
// notify default control that it may become/lost active default again
|
||||||
if (FDefaultControl <> nil) and (FDefaultControl <> lPrevControl) then
|
if Assigned(FDefaultControl) and (FDefaultControl <> lPrevControl) then
|
||||||
FDefaultControl.ActiveDefaultControlChanged(AControl);
|
FDefaultControl.ActiveDefaultControlChanged(AControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1927,9 +1932,9 @@ end;
|
|||||||
|
|
||||||
procedure TCustomForm.SetLastFocusedControl(AControl: TWinControl);
|
procedure TCustomForm.SetLastFocusedControl(AControl: TWinControl);
|
||||||
begin
|
begin
|
||||||
if FLastFocusedControl=AControl then exit;
|
if FLastFocusedControl = AControl then exit;
|
||||||
FLastFocusedControl:=AControl;
|
FLastFocusedControl := AControl;
|
||||||
if FLastFocusedControl<>nil then
|
if Assigned(FLastFocusedControl) then
|
||||||
FLastFocusedControl.FreeNotification(Self);
|
FLastFocusedControl.FreeNotification(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2560,10 +2565,8 @@ end;
|
|||||||
|
|
||||||
procedure TCustomForm.DestroyWnd;
|
procedure TCustomForm.DestroyWnd;
|
||||||
begin
|
begin
|
||||||
if FMenu <> nil then
|
if Assigned(FMenu) then
|
||||||
begin
|
|
||||||
FMenu.DestroyHandle;
|
FMenu.DestroyHandle;
|
||||||
end;
|
|
||||||
inherited DestroyWnd;
|
inherited DestroyWnd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user