01-25-2011 09:17 AM
Does anyone know how to assign a keyboard macro to a keyboard shortcut? I am spoiled from using CodeWright, if there is nothing selected when a 'Ctrl c' is issued, CodeWright automatically copies the line the cursor is on. I'm trying to replicate that feature and the only way I can see is a keyboard macro of the 'Copy Line' right click command. Any thoughts?
Solved! Go to Solution.
01-25-2011 12:05 PM
NABI:
It sounds like you're talking about editing source code. I don't know a way to create your own keyboard macro. You can change the shortcut key assignments (CVI 9.1: Options -> Change Shortcut Keys), but it sounds like you need more than that.
To do your example (copying an unhighlighted line), I often press Ctrl-Y, to cut the current line, immediately followed by a Ctrl-V to restore the original line. That line is still in the clipboard buffer, so I then move to where I want the copy of the original line and press Ctrl-V again.
In case you're not asking about editing code but creating shortcuts for your users in your application, you can trap EVENT_KEYPRESS in your panel callback or control callback and check for key code combinations. See the example program multikey.prj that ships with CVI, and the CVI help for EVENT_KEYPRESS.