Re: NSNumberFormatter question
Re: NSNumberFormatter question
- Subject: Re: NSNumberFormatter question
- From: Ricky Sharp <email@hidden>
- Date: Mon, 4 Sep 2006 09:41:18 -0500
On Sep 4, 2006, at 5:09 AM, Vinay Prabhu wrote:
I have a NSTextField, which should accept values ranging from -180
to +180.
I have subclassed the NSNumberFormatter and used it to filter the
inputs to
text field.
The problem is, when I set the negative numbers programmatically to
text
field, it displays the hyphen "-" indicating the negative value.
But when I try to enter the hyphen "-" through keyboard, it doesn't
display
"-", instead number 0 is displayed.
I have used all the formats given in the NSFormatter documentation,
i.e,
'just positve format', 'positive and negative format' and
'positive, zero
and negative format'.
There are API's to set the negative symbols, minus sign etc in
NSNumberFormatter class, but they are supported for 10.4 onwards.
I need to support the software from 10.3 onwards.
If all you need to do is have your field be restricted to the range
[-180..180], why not just use an NSNumberFormatter (i.e. why are you
subclassing?)
While I'm on 10.4.7, I created a nib to target 10.3, added a text
field and then dragged the formatter and set up its attributes. When
testing the interface, I was able to enter in any number in the range
(hyphens remained in the edit field a-ok).
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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