• 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: Keyboard events in an NSTextEntry
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keyboard events in an NSTextEntry


  • Subject: Re: Keyboard events in an NSTextEntry
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 28 Mar 2002 18:07:04 -0800

On Thursday, March 28, 2002, at 03:27 PM, Timothy Ritchey wrote:

I have an NSTextEntry (in an NSWindow) that I need to intercept some keystrokes for - specifically, I want to intercept '=' and num-lock and handle them myself (simulate clicking on specific buttons) but let the rest of them go to the NSTextEntry. I've looked in the documentation and online and there's no good, simple, example... can someone help me out?


Do you mean an NSTextView? Here is a function I use to intercept tabs, returns, shift-tabs, and arrow keys to change the cell I am editing in the spreadsheet. Set yourself as the delegate of the NSTextView, and implement this method in your delegate:

- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector

textView:doCommandBySelector: will allow you to deal with keys that are bound to commands. For ordinary keys like '=' you might use textView:shouldChangeTextInRange:replacementString:.

Douglas Davidson
_______________________________________________
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.

References: 
 >Re: Keyboard events in an NSTextEntry (From: Timothy Ritchey <email@hidden>)

  • Prev by Date: Re: Bug in g++'s int constructor?
  • Next by Date: Re: coco for ms windows
  • Previous by thread: Re: Keyboard events in an NSTextEntry
  • Next by thread: Re: Keyboard events in an NSTextEntry
  • Index(es):
    • Date
    • Thread