Re: Changing up/down arrow behavior for NSTextField
Re: Changing up/down arrow behavior for NSTextField
- Subject: Re: Changing up/down arrow behavior for NSTextField
- From: "Adam Gerson" <email@hidden>
- Date: Wed, 20 Feb 2008 00:45:52 -0500
Try implementing textView:doCommandBySelector: in your NSTextView
subclass. This should detect the up/down arrow keys.
-(BOOL)textView:(NSTextView *)aTextView doCommandBySelector: (SEL)aSelector{
NSLog(@"selector: %s", (char *)aSelector);
return NO;
}
Adam
On 2/13/08, Duncan Champney <email@hidden> wrote:
> My app uses a number of numeric input fields, with sliders, to input
> floating point values. I'd like the user to be able to press up/down
> arrow to increase/decrease the input value by .001, and shift up/down
> arrow to increase decrease the input value by .1, much like the way
> Photoshop does.
>
> As mentioned in a previous post, using a key binding and the
> control:textView:doCommandBySelector method seems the way to do this,
> but I can't find an explanation of how to do this, and am not clear on
> how bindings work. If somebody could point me to a good reference that
> covers the subject, or a sample app that uses key bindings to
> implement special keys, that would be great.
>
> Failing that, I tried to subclass NSTextField and add a -keyDown
> method to my subclass. Other methods in my subclass, like
> textShouldBeginEditing, (the delegate methods) get called, but not my -
> keyDown method. I gather this has something to do with the way Cocoa
> uses a single shared NSTextView object to manage all editing in a
> window, but I can't figure out how to make it work.
>
> Can somebody give me some suggestions? I'm at a loss as to how to make
> this work.
>
>
>
> Duncan Champney
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden