HEllo Fritz

Yep. Im using the obejctValue of the TextField and getting the DecimalNumber 
now.

and Im changing that double as you suggested.


Thanks for the reply.


On 17.5.2010, at 22:51, Fritz Anderson wrote:

> On 17 May 2010, at 7:15 AM, Gustavo Pizano wrote:
> 
>> 
>> I need to get the value of a textfiled which has a NSNumberFormatter with 
>> currency style.
>> 
>> Now, Im doing:
>> 
>>                      double d = [amountPayedTF doubleValue];
>>              NSDecimalNumber * dm = (NSDecimalNumber *)[NSDecimalNumber 
>> numberWithDouble:d];
>>              ..
>> 
>> so then I can compare the decimals number with the entitie's attributes.
>> 
>> BUT, on d, Im always getting just the thousand digit (the first one) when 
>> inputing for example 2664, when formatted it becomes 2.664.00 €, so Im 
>> geting only 2, if I put 264 --> 264.00 € I get the 264, and if I put 264.15 
>> -> 264.15 € I get 264.15 in d...
> 
> My experiments show that NSNumberFormatter does not tolerate grouping 
> separators in input text. Or at least I wasn't able to force it.
> 
> On another subject, I'd recommend that you never pass currency amounts 
> through a double. You have a formatter attached to your field. Set it to 
> always return an NSDecimalNumber (it's in the Mac OS X 10.4+ Custom 
> inspector), and use the objectValue method of the text field to retrieve the 
> decimal number directly.
> 
>       — F
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to