I am developing an app for Mac OS X and I need to listen to keyboard shortcut inputs so I can act on them.
For example:
- Up and down keys move up and down on a table view.
- ⌘ + ⌦ drops an item.
- ⌘ + ⇧ + N creates a new item.
It shouldn’t be restricted to events on the focused control.
Any ideas?
Thanks in advance.
Have a look at the Cocoa Event-Handling Guide. There are a few places you can intercept events before they get to the key view. You can intercept all events in the application by overriding
-[NSApplication sendEvent:], or you can intercept events at a per-window level by overriding-[NSWindow sendEvent:].