• 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
"final" string validation in custom NSFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"final" string validation in custom NSFormatter


  • Subject: "final" string validation in custom NSFormatter
  • From: Mark Dawson <email@hidden>
  • Date: Fri, 10 Dec 2004 10:48:28 -0800

When writing a custom formatter, how do I do a "final" string validation? I've overriden "isPartialStringValid", which works fine, up to a point.

In my case, I allow fractions. So the user typing in "1/" is valid to that point. However, if they try to commit that (pressing the enter key, tabbing, exiting out, etc) the string is now INVALID (i.e., you need a denominator).

<x-tad-bigger>I assume there should be some test in </x-tad-bigger>getObjectValue for "exit key", returning an error (not allowing the user to exit) if the final keys are not valid, and a similar test in <x-tad-bigger>stringForObjectValue that would not cause a reformat until the text field was committed & validated (i.e., I might allow fractional input, but want only decimal output, 1/2 --> 0.5).
</x-tad-bigger>
Thanks for any insight!

mark
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: "final" string validation in custom NSFormatter
      • From: "Louis C. Sacha" <email@hidden>
  • Prev by Date: Re: Aqua icons from system fonts
  • Next by Date: Re: Lost ability to alt-drag IB items [Solved]
  • Previous by thread: NSTableView dragging vrs NSOutlineView dragging
  • Next by thread: Re: "final" string validation in custom NSFormatter
  • Index(es):
    • Date
    • Thread