• 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: NSTextView keydown alternative?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView keydown alternative?


  • Subject: Re: NSTextView keydown alternative?
  • From: Nik Youdale <email@hidden>
  • Date: Sun, 15 Jan 2006 10:17:01 +1100


On 15/01/2006, at 12:06 AM, Jim Correia wrote:

On Jan 14, 2006, at 6:58 AM, Nik Youdale wrote:

I am building a custom view that consists of a textview (mainly) which holds first responder status, and allows text input by the user. I have implemented the "textView:shouldChangeTextInRange:replacementString:" delegate method to detect when characters are pressed, and to also detect when keys such as return and tab are pressed so that i can disable their action and/or invoke other methods.
What I need is someway of detecting when other keys are pressed such as delete and arrow keys. I have tried overriding keydown, but then i can't type into the textview. I need someway of detecting these keystrokes and to still allow typing and the "textView:shouldChangeTextInRange:replacementString:" delegate method.

If you are subclasses for other reasons, great. But you don't have to subclass to customize the keystroke behavior. In addition to textView:shouldChangeTextInRange:replacementString, look at - (BOOL) textView:(NSTextView *)textView doCommandBySelector:(SEL) commandSelector;


Jim

oh ok. thanks. i am still fairly new to cocoa though, and dont know what a selector is.... could someone perhaps explain? is it some sort of identifier for different keys? like enumerations?? or is it more like the name of a method to be called as in requesting to receive notifications from the notification centre??


also, what ever it is, how do i use it to identify which key was pressed?

cheers

- Nik

_______________________________________________
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: 
 >NSTextView keydown alternative? (From: Nik Youdale <email@hidden>)
 >Re: NSTextView keydown alternative? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: How to get initial values into dialog via bindings?
  • Next by Date: Re: How to get initial values into dialog via bindings?
  • Previous by thread: Re: NSTextView keydown alternative?
  • Next by thread: Re: NSTextView keydown alternative?
  • Index(es):
    • Date
    • Thread