Re: intercepting keydowns
Re: intercepting keydowns
- Subject: Re: intercepting keydowns
- From: Douglas Davidson <email@hidden>
- Date: Mon, 4 Apr 2005 08:43:57 -0700
On Apr 2, 2005, at 12:35 PM, Satoshi Matsumoto wrote:
on 05.4.3 1:59 AM, Roland Silver at email@hidden wrote:
I have a simple Cocoa application with a controller and a window with
an NSTextView. I want to intercept keydown events on their way to the
text view, process them with a function or method, and send a
possibly
different keydown event on to the text view.
Nothing I try works.
Any suggestions?
Subclass NSTextView and override following method.
- (void)keyDown:(NSEvent *)theEvent
I want to again recommend against subclassing NSTextView and
overriding keyDown: except in extreme circumstances. In most cases
it is better to act as the text view's delegate and handle
textView:doCommandBySelector:,
textView:shouldChangeTextInRange:replacementString:,
textView:willChangeSelectionFromCharacterRange:toCharacterRange:, and
so forth. You should override keyDown: if you want to handle raw key
presses before any input methods or key bindings have been applied;
if you do not want that, then you should avoid overriding keyDown:.
Douglas Davidson
_______________________________________________
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