Keyboard Shortcut Control?


I’m looking to create a control that allows the user to enter the key combination for a shortcut to a text field, as in ??D. As an example, the way the user can enter something in Keyboard Shortcuts under Keyboard in OSX System Preferences

Before getting stuck into my own canvas based control does anyone know of anything that already exists - plugin control or maybe on the Cocoa framework? Only going to be implemented on a Mac.


try something like (in the keyPressed event):

select case details.charCode
case details.keyEscape
. . . stuff to do if escape pressed
case details.keyBackspace, details.keyDelete
. . . stuff to do if backspace or delete pressed
end select

Sorry for the late reply, key pressed doesn’t trap keys like ??. Think there was a blog entry on trapping these keys.

I’m pretty sure I know how I’m going to create my own control to do this. Hoping to have some time next week to get it done!

Patrick, did you ever get around to it? Any lessons learned?

My problem is that I’m deploying a Windows app to translators, so it’s used just about everywhere in the world you can think of, but the menu shortcuts don’t work reliably on windows. I have a US-friendly, and an AZERTY-friendly (french) set of shortcuts right now, and they work great on the Mac, but on windows, a lot of stuff just doesn’t fire a menu response.

Trying to figure out how to have custom mapping of keyboards for all users, and have it work reliably, no matter what physical keyboard they are using. One trick is that from a usability point, you want to the shortcuts to show up in the menu, even if you have to (re) detect them yourself with a timer.


I could actually use the same control if you got something working and wouldn’t mind sharing.