Thursday, June 22, 2006

IDE AddIn - Putting focus in the Code Editor by using a keyboard shortcut

One of the most annoying things that happened when Borland Developer Studio first shipped was that when returning from a debugging session the Code Editor didn't have focus.

This was rectified in Update 2 although reseting your running application (Ctrl+F2) still doesn't reset focus back to the Code Editor.

I have always wished for a shortcut to set focus to the Code Editor (as much as I like the F12 and F11 dance) and because of the oversight with the initial BDS 2006 release I decided to do something about it. Using some code from my Bookmark Viewer Add In (its on CodeCentral for those interested - with source) I've created an IDE Add In that sets the focus to the Code Editor when I press Ctrl+ALT+E.

Source is included so you can modify the shortcut used if you want.

You can download this Add In with source from here. Please adhere to the license conditions.

If the Welcome Page is active then pressing the shortcut does nothing. A unit must be selected for the Units code editor to receive focus.

5 Comments:

Anonymous Anonymous said...

Thanks, JED. This will be very useful! One minor nitpick though: The shortcut doesn't work out of the box on non-English IDEs because SHORT_CUT isn't localized - i.e it would have to be 'Strg+Alt+E' for a German Delphi. Maybe you want to change the type of TActionArgs.ShortCut to TShortCut or something similar to remove this issue.

12:32 AM  
Blogger JED said...

Hi Uli,

Thanks for your suggestion.

cheers,
Jeremy

8:02 AM  
Blogger Rob Kennedy said...

You should mention this add-in in the comments for QC 11089.

1:33 PM  
Blogger Albert Research said...

thanks JED... you made my day... I was looking for long for one think to open me the door to be able to Maximize the Editor Window with a shortcut... and THIS is the code... Thank you very much...

6:17 PM  
Blogger JED said...

Hi Rob,

I've added a comment to the QC report that has a link to the blog post.

Hi Albert,

Glad I could be of assistance.

6:58 PM  

Post a Comment

<< Home