Re: Keyboard events in an NSTextEntry
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.