• 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: Changing up/down arrow behavior for NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Changing up/down arrow behavior for NSTextField (From: Duncan Champney <email@hidden>)

  • Prev by Date: re: Is it possible to override a property in an Entity subclass in CoreData?
  • Next by Date: Re: NSPopUpButton menu list not showing all the menu items
  • Previous by thread: Re: Changing up/down arrow behavior for NSTextField
  • Next by thread: Re: Changing up/down arrow behavior for NSTextField
  • Index(es):
    • Date
    • Thread