• 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: NSStepper and NSTextField changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStepper and NSTextField changes


  • Subject: Re: NSStepper and NSTextField changes
  • From: matt neuburg <email@hidden>
  • Date: Thu, 12 Dec 2002 18:33:48 -0800

On Thu, 12 Dec 2002 17:13:06 -0600, Brad Oliver <email@hidden> said:

>In my app, I have close to a hundred NSTextField/NSStepper
>combos which basically manage a bunch of number inputs.
>
>I need to be notified when the text field changes, so I've
>set the delegate of all these fields to handle
>controlTextDidChange. This works fantastic when the user
>types in new numbers, and I can act appropriately.
>
>However, if the text field does not have focus and the
>user clicks on the stepper, I never get notified that the
>text field changes.
>
>Is there a smooth way to solve this, or do I need to write
>a lot of code to deal with each one of these steppers?

You needn't write a *lot* of code. One line will do. Let us assume that the stepper communicates with its textfield through the latter's takeIntValueFrom method. Override that method to post a notification. You don't even have to bother turning all your hundred textfields into this subclass; just have the subclass pose as NSTextField. Kewl! m.

matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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.

  • Prev by Date: Re: Placing an NSRect into an NSImage
  • Next by Date: Re: NSTableView oddity
  • Previous by thread: NSStepper and NSTextField changes
  • Next by thread: Re: NSStepper and NSTextField changes
  • Index(es):
    • Date
    • Thread