LCL: Improve giving focus to docked windows from Windows menu. Issue #32659, patch from Pascal Riekenberg.

git-svn-id: trunk@56417 -
This commit is contained in:
juha 2017-11-16 11:19:00 +00:00
parent 4111fd882a
commit 93f48e1da6
3 changed files with 7 additions and 1 deletions

View File

@ -372,7 +372,7 @@ begin
end;
finally
OldActiveControl:=AForm.ActiveControl;
OldActiveControl:=AForm.LastActiveControl;
{$IF defined(VerboseAnchorDocking) or defined(VerboseAnchorDockRestore)}
if not AForm.IsVisible then
debugln(['TIDEAnchorDockMaster.ShowForm MakeVisible ',DbgSName(AForm),' ',dbgs(AForm.BoundsRect),' Floating=',DockMaster.IsFloating(AForm)]);

View File

@ -461,6 +461,7 @@ type
FKeyPreview: Boolean;
FMenu: TMainMenu;
FModalResult: TModalResult;
FLastActiveControl: TWinControl;
FLastFocusedControl: TWinControl;
FOldBorderStyle: TFormBorderStyle;
FOnActivate: TNotifyEvent;
@ -701,6 +702,7 @@ type
property Menu : TMainMenu read FMenu write SetMenu;
property ModalResult : TModalResult read FModalResult write SetModalResult;
property Monitor: TMonitor read GetMonitor;
property LastActiveControl: TWinControl read FLastActiveControl;
property PopupMode: TPopupMode read FPopupMode write SetPopupMode default pmNone;
property PopupParent: TCustomForm read FPopupParent write SetPopupParent;

View File

@ -1911,6 +1911,8 @@ begin
Debugln(['TCustomForm.SetActiveControl ',DbgSName(Self),' FActive=',DbgS(FActive),' OldActiveControl=',DbgSName(FActiveControl),' NewActiveControl=',DbgSName(AWinControl)]);
{$ENDIF}
FActiveControl := AWinControl;
if (FActiveControl<>nil) and (FActiveControl<>Self) and not (FActiveControl is TCustomForm) then
FLastActiveControl := FActiveControl;
if Assigned(FActiveControl) then FreeNotification(FActiveControl);
if ([csLoading, csDestroying] * ComponentState = []) then
begin
@ -2478,6 +2480,8 @@ begin
debugln(['TCustomForm.SetFocusedControl ',DbgSName(Self),' OldActiveControl=',DbgSName(FActiveControl),' New=',DbgSName(Control)]);
{$ENDIF}
FActiveControl := Control;
if (FActiveControl<>nil) and not (FActiveControl is TCustomForm) then
FLastActiveControl := FActiveControl;
if Assigned(FActiveControl) then
FreeNotification(FActiveControl);
end;