• 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: Building a calculator text field: problem with NSFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building a calculator text field: problem with NSFormatter


  • Subject: Re: Building a calculator text field: problem with NSFormatter
  • From: Niko Matsakis <email@hidden>
  • Date: Thu, 30 Nov 2006 20:29:39 +0100


The most direct way to do what you want would be to use a validator instead
of a formatter, but you *could* use a formatter if you have some trigger
value, say, an equals character. If you evaluate the "expression" only when
the string value ends in an equals, you will probably get what you want.
The problem with using a validation method is that it's associated with the core data object, rather than the text field, yes? Actually, in this case that's probably fine, but I would eventually like to make a "calculating text field" as something in my tool box, that would work regardless of what it was bound to.

You did mean a validation method when you said "validator", right? Is there a way to have a separate validator object of some sort?

I remember that I also tried to use an NSValueTransformer; I'm not sure anymore why I backed off from that approach.

Thanks to both of you, anyhow, I will experiment with allowing errors, and with using a validation method.


Niko _______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Re: Building a calculator text field: problem with NSFormatter (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Getting the text out of iWork Pages file
  • Next by Date: Re: Getting the text out of iWork Pages file
  • Previous by thread: Re: Building a calculator text field: problem with NSFormatter
  • Next by thread: Re: Building a calculator text field: problem with NSFormatter
  • Index(es):
    • Date
    • Thread