WebView keyboard events
WebView keyboard events
- Subject: WebView keyboard events
- From: malcom <email@hidden>
- Date: Mon, 16 Oct 2006 00:52:29 +0200
Hi list,
I need to intercept keys inside a WebView.
From this: http://lists.apple.com/archives/webkitsdk-dev/2004/May/msg00014.html
I can read:
-----
"Subclassing the WebView won't work, because this key binding is
handled by another view inside the WebView.
The easiest way get the event before the view inside the WebView does
is to subclass NSWindow and override sendEvent: or subclass
NSApplication and override sendEvent:."
------
Ok I've subclassed my NSWindow:
- (void)keyDown:(NSEvent *)theEvent { NSLog(@"click"); }
- (BOOL) becomeFirstResponder { return YES; }
- (void)flagsChanged:(NSEvent *)theEvent { }
- (void)keyUp:(NSEvent *)theEvent { }
- (BOOL)acceptsFirstResponder { return YES; }
- (BOOL)resignFirstResponder { return YES; }
- (void)sendEvent:(NSEvent *)theEvent {
NSLog(@"send event");
[super sendEvent: theEvent];
}
------
now the problem appears when the user click on an object and my
NSWindow stops to receive the keyDown events (->
resignFirstResponder). Now if I try to return NO in
resignFirstResponder I cannot use my interface.
How can I continue to receive events about keys pressed? Is there a
way? (In fact I need to use them only when an NSTabView show a
particular tabviewitem).
Thanks a lot
malcom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden