Blog

Sunday, April 28, 2013
Remapping Keystrokes in MorphX
The shortcut keys used in MorphX, the Dynamics AX code editor, are almost exactly the same as those used in Visual Studio. In fact, the code editor basically *is* the editor from Visual Studio, with somewhat reduced functionality, if I understand correctly.

The one thing that's always bugged me about it is that the keystrokes for commenting and un-commenting code are different. In VS (and various other editors), it's Ctrl-K,Ctrl-C and Ctrl-K,Ctrl-U. For no obvious reason, MorphX uses Ctrl-E,Ctrl-C and Ctrl-E,Ctrl-U. This isn't *too* bad, until you start getting used to it, then you accidentally press Ctrl-E in SQL Management Studio, hence executing a block of SQL instead of commenting it out. After doing *that* a few times, I decided that I needed to fix MorphX.

Surprisingly, I couldn't find any facility built into AX for changing keyboard shortcuts. So, I turned to AutoHotKey. It's very easy to remap a single keystroke in AHK. For instance, I can just remap Ctrl-K to Ctrl-E with "^k::^e". I went ahead and did that for awhile, since it didn't really seem that there would be any harm in that. But, I wanted to figure out how to create a more targeted replacement, so only the two specific commands would get remapped.

The snippet below does that. And, or course, it limits the remapping to the AX code editor.

Labels: ,

posted by Unknown 8:00 AM
0 comments

Comments: Post a Comment


This page is powered by Blogger. Isn't yours?
© 2011 Andrew Huey