开发者

Catching keyboard events in a Cocoa app WebView

开发者 https://www.devze.com 2022-12-13 23:24 出处:网络
I have a Cocoa app开发者_JAVA百科 that embeds a WebView. I\'d like to intercept a keyboard shortcut so that I may perform an action in the WebView.

I have a Cocoa app开发者_JAVA百科 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消