Re: Forwarding events
Re: Forwarding events
- Subject: Re: Forwarding events
- From: Allan Odgaard <email@hidden>
- Date: Sat, 17 Jul 2004 21:48:29 +0200
On 17. Jul 2004, at 20:01, Rick Bischoff wrote:
Earlier I posted a question to which I have received no response-- so
I will ask a similar question in the hopes somebody knows the answer.
The situation:
Oh... just sent you a private reply, a few days/weeks behind on
CocoaDev ;)
Everything works except for the last keyDown message-- I hear a system
beep, windowB is in the foreground and the text field is the first
responder. -- It does not respond normally to the keyDown message.
Why not?
The text field itself is not responsible for the editing. It asks the
field editor to do that, so your events should probably be forwarded to
the field editor, not the text field.
I say probably because I am not 100% sure that all of the native views
follow the documented procedures when it comes to event handling. At
least I stumbled upon a rather strange thing:
If I implement moveLeft: and moveRight: in an NSView subclass which I
place in an NSScrollView, then pressing ctrl-left/right will call these
methods w/o first going through my keyDown: implementation -- though
according to the default key bindings, ctrl-left/right should actually
go to bol/eol (but pressing a key should call keyDown:, no matter what
the key bindings say).
Now NSTextView also implements moveLeft: and moveRight:, but here
ctrl-left/right *do* move to bol/eol.
So are the NSTextView getting key events differently than my view
subclass???
I reported it as a bug but just got a "behaves correctly" and that I
could not rely on getting "command keys" (though I think I managed to
get them to re-open it, but I think it was a while before the Panther
release, and nothing has changed). My workaround is to implement
respondsToSelector: and return NO for the moveLeft/Right: action
methods, then I do get my keyDown: message and then interpretKeyEvents:
will correctly map the key to moveToBeginning/EndOfLine:
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.