Re: Number only NSTextField's
Re: Number only NSTextField's
- Subject: Re: Number only NSTextField's
- From: Eric Gorr <email@hidden>
- Date: Fri, 21 Dec 2007 00:10:25 -0500
Thanks for the reply.
Would it not be possible to subclass NSNumberFormatter and override
(at least partially) isPartialStringValid?
I would think I could check the incoming string for non-numbers and if
found, return NO...if not found, call NSNumberFormatter's
isPartialStringValid function.
I would hate to lose (or have to reproduce) some of the nice
functionality of the NSNumberFormatter...
It seems the NSNumberFormatter does prevent the user from entering
letters so long as they first typed a number, but if the field is
empty to begin with, there doesn't seem to be anything to prevent the
user from entering a letter....seems like a bug.
On Dec 20, 2007, at 11:50 PM, Apparao wrote:
Write your own custom formatter, which is subclass of NSFormatter.
Read the following article exists in your machine:
file:///Developer/ADC Reference Library/documentation/Cocoa/Conceptual/DataFormatting/index.html
- Apparao.
Effigent Inc.
On Dec 21, 2007, at 10:03 AM, Eric Gorr wrote:
I found this old thread:
http://lists.apple.com/archives/cocoa-dev/2002/Sep/msg00112.html
which suggests applying a NSNumberFormatter to my field.
I have been able to do this and, while it does seem to only accept
actually numbers in the field (the focus won't change to another
control until it is a number), I can still type letters, etc. into
the field as well.
I would prefer that it just beep when I enter a letter, etc. and
for that letter to never appear in the field.
What is the best way to accomplish this?
Thank you.
_______________________________________________
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
_______________________________________________
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