• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
WebView keyboard events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: KVC Problems with Indexed Accessor - (A Solution)
  • Next by Date: Re: NSFont and determining the advancement of a given string
  • Previous by thread: Re: Sending ASCII Messages to a TCP Socket
  • Next by thread: Compositing a CIImage to NSBitmapImage planar problems
  • Index(es):
    • Date
    • Thread