sam
sam

Reputation: 3479

Catching keyboard events in a Cocoa app WebView

I have a Cocoa app that embeds a WebView. I'd like to intercept a keyboard shortcut so that I may perform an action in the WebView.

I do not want to implement a menu item for this action. In fact, ideally I only want this shortcut to apply when the user is in a textarea box in the WebView.

How do I catch the keyboard shortcut so that I can pass it on to my WebView?

Upvotes: 1

Views: 1152

Answers (1)

Azeem.Butt
Azeem.Butt

Reputation: 5861

You can either have something higher up in the responder chain handle it first or use a CGEventTap if that doesn't cut it.

Upvotes: 1

Related Questions