Search code examples
objective-cevent-handlingmacos-carbon

How to propagate an event up to handler chain (Carbon) after it handled by my custom handler?


I need to handle a Tab key press in my application. In some conditions I want to do some stuff in my handler and suppress further event handling and in other cases I just skip and let other standard handlers to handle this event.

Here is my very simple app where I'm trying to do it. https://github.com/prudnikov/TestGlobalShortcut/blob/master/TestGlobalShortcut/AppDelegate.m

It catches tab press but it always suppresses further event handling. I mean when I press Tab in the text editor the tab key is not inserted.

Can you advise what should I do to propagate standard event handlers?


Solution

  • I don't think you can do that using RegisterEventHotKey. But unless you need to receive the tab key when your app is not frontmost, you should not be using RegisterEventHotKey. Use a regular Carbon Event handler, or use Cocoa event handling techniques.