From 1953444e63e81af587af9bd19e07a3877e4e5724 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 27 Jun 2012 16:01:13 +0000 Subject: [PATCH] IDE: when doing a source editor command from via menu then focus editor git-svn-id: trunk@37800 - --- ide/main.pp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ide/main.pp b/ide/main.pp index cfbb379dc2..55606a4c52 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -918,7 +918,8 @@ type // edit menu procedure DoCommand(ACommand: integer); override; - procedure DoSourceEditorCommand(EditorCommand: integer; CheckFocus: boolean = true); + procedure DoSourceEditorCommand(EditorCommand: integer; + CheckFocus: boolean = true; FocusEditor: boolean = true); procedure UpdateCustomToolsInMenu; // external tools @@ -19132,7 +19133,8 @@ begin end; end; -procedure TMainIDE.DoSourceEditorCommand(EditorCommand: integer; CheckFocus: boolean); +procedure TMainIDE.DoSourceEditorCommand(EditorCommand: integer; + CheckFocus: boolean; FocusEditor: boolean); var CurFocusControl: TWinControl; ActiveSourceEditor: TSourceEditor; @@ -19151,8 +19153,11 @@ begin if Assigned(CurFocusControl) then begin // MainIDEBar or SourceNotebook has focus -> find active source editor GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo); - if Assigned(ActiveSourceEditor) then + if Assigned(ActiveSourceEditor) then begin ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand); // pass the command + if FocusEditor then + ActiveSourceEditor.EditorControl.SetFocus; + end; end; // Some other window has focus -> continue processing shortcut, not handled yet if (CurFocusControl=Nil) or (ActiveSourceEditor=Nil) then @@ -19185,8 +19190,8 @@ begin with TOpenDialog.Create(nil) do try Title:=lisSelectFile; - if Execute then - ActiveSrcEdit.Selection := FileName; + if not Execute then exit; + ActiveSrcEdit.Selection := FileName; finally Free; end;