• 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: NSNumberFormattter not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumberFormattter not working


  • Subject: Re: NSNumberFormattter not working
  • From: Keary Suska <email@hidden>
  • Date: Thu, 12 Jul 2007 09:48:00 -0600
  • Thread-topic: NSNumberFormattter not working

on 7/12/07 8:59 AM, email@hidden purportedly said:

> Well I played around with a formatter in IB and apparently number
> formatters don't prevent alpha entry they only beep on completion to
> indicate that something is wrong.
>
> I must be "fighting the framework" here, as I can't believe that
> something so conceptually simple as restricting text input to only
> valid numeric characters, would require delegates or overriding the
> application's key handling mechanism. (Which is what several threads
> at CocoaDev suggested)
>
> I know the following NSTextField method doesn't exist, but is there
> some reasonably simple technique that would simulate it's functionality?
>
> [aTextField setValidCharacterSet: [NSCharacterSet
> decimalDigitCharacterSet]];

All you need is a custom NSFormatter subclass. Read the NSFormatter API,
particularly -isPartialStringValid:newEditingString:errorDescription:

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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: NSNumberFormattter not working
      • From: Ken Tozier <email@hidden>
References: 
 >Re: NSNumberFormattter not working (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Cross-platform toolkit with a Cocoa backend
  • Next by Date: Re: Changing the behavior of 'Return' in NSTableView
  • Previous by thread: Re: NSNumberFormattter not working
  • Next by thread: Re: NSNumberFormattter not working
  • Index(es):
    • Date
    • Thread