From 48d4107e26c16fa4de7ae6014291b626a5288897 Mon Sep 17 00:00:00 2001 From: juha Date: Sat, 26 May 2012 07:25:27 +0000 Subject: [PATCH] IDE: Focus active source editor before executing menu command, did not work with anchordocking. Issue # 22114, modified from patch by Takeda Matsuki git-svn-id: trunk@37422 - --- ide/sourceeditor.pp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index 57a2f069c6..bda02c5cad 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -1297,14 +1297,16 @@ var ActEdit: TSourceEditor; r: Boolean; begin - if (SourceEditorManager = nil) or (Sender = nil) or not(Sender is TIDEMenuCommand) then - exit; + if SourceEditorManager = nil then exit; + if not (Sender is TIDEMenuCommand) then exit; + if TIDEMenuCommand(Sender).Command = nil then exit; ActEdit := SourceEditorManager.ActiveEditor; - if (ActEdit = nil) or (TIDEMenuCommand(Sender).Command = nil) then - exit; - r := TIDEMenuCommand(Sender).Command.OnExecuteProc = @ExecuteIdeMenuClick; + if ActEdit = nil then exit; + r := TIDEMenuCommand(Sender).Command.OnExecuteProc = @ExecuteIdeMenuClick; if r then TIDEMenuCommand(Sender).Command.OnExecuteProc := nil; + // Commands may not work without focusing when anchordocking is installed + ActEdit.FocusEditor; ActEdit.DoEditorExecuteCommand(TIDEMenuCommand(Sender).Command.Command); if r then TIDEMenuCommand(Sender).Command.OnExecuteProc := @ExecuteIdeMenuClick;