Re: Up arrow in NSTextView
Re: Up arrow in NSTextView
- Subject: Re: Up arrow in NSTextView
- From: Douglas Davidson <email@hidden>
- Date: Tue, 29 Mar 2005 13:33:00 -0800
On Mar 29, 2005, at 1:23 PM, Adam wrote: What is the easiest way for me to detect that the user has pressed a specific key in an NSTextView?
The most appropriate thing is to be precise about exactly what you want to do. NSTextView offers a variety of delegate methods for controlling its behavior, notably textView:doCommandBySelector:, textView:willChangeSelectionFromCharacterRange:toCharacterRange:, and textView:shouldChangeTextInRange:replacementString:. These operate at the level of the action requested by the user, not at the level of a specific key, because keystrokes are too low-level to be a reasonable point of intervention in most cases. If you need to go beyond what the delegate interface offers, you can of course subclass and override methods such as keyDown:. Bear in mind, however, that the keyDown: method gets raw key presses, before any keybinding or input method processing has been done.
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