RE: NSNumberFormatter question
RE: NSNumberFormatter question
- Subject: RE: NSNumberFormatter question
- From: Vinay Prabhu <email@hidden>
- Date: Mon, 4 Sep 2006 20:36:24 +0530
- Importance: Normal
Hi,
I have tried the same thing on OS 10.3.9 with XCode 1.5, GCC 3.3.
Created a new Cocoa Project. Added a text field to the window.
Instantiated the NSNumberFormatter. Set up the attributes of the number
formatter.
Connected the text field to the number formatter via "formatter" outlet.
When I run the application, text field accepted all values (including
characters), as if there is no formatter.
Am I missing something here, while setting up the formatter?
Regards
Vinay
-----Original Message-----
From: Ricky Sharp [mailto:email@hidden]
Sent: Monday, September 04, 2006 8:11 PM
To: Vinay Prabhu
Cc: email@hidden
Subject: Re: NSNumberFormatter question
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