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

Changing up/down arrow behavior for NSTextField


  • Subject: Changing up/down arrow behavior for NSTextField
  • From: Duncan Champney <email@hidden>
  • Date: Wed, 13 Feb 2008 10:57:45 -0500

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


  • Follow-Ups:
    • Re: Changing up/down arrow behavior for NSTextField
      • From: "Adam Gerson" <email@hidden>
    • Re: Changing up/down arrow behavior for NSTextField
      • From: Joshua Emmons <email@hidden>
  • Prev by Date: Re: Mail-like grouping in NSTableView?
  • Next by Date: Re: MD5 check sum of a file
  • Previous by thread: Re: Mail-like grouping in NSTableView?
  • Next by thread: Re: Changing up/down arrow behavior for NSTextField
  • Index(es):
    • Date
    • Thread