• 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
Re: Up arrow in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Up arrow in NSTextView (From: Adam <email@hidden>)

  • Prev by Date: Re: Up arrow in NSTextView
  • Next by Date: Re: Up arrow in NSTextView
  • Previous by thread: Re: Up arrow in NSTextView
  • Next by thread: Moving Files From /private/tmp
  • Index(es):
    • Date
    • Thread