Hello,
I have been looking all day, tried a million thing, but I cannot find the reason why this doesnt work. I have an application that takes 3 Text Field’s values and does a calculation onto them. My problem is with one of them only. I have bound the value of this text field to a property in Xcode, and everything is fine until I attach a NSNumberFormatter onto it in Interface Builder. I need it formatted like this: “#,##0.00” and also localized, but if I try to coerce the contents to a number in AS, it gives me an error:
“Can’t make “29.79999923706055” into type number.”
The closest I have gotten to a solution looks like this:
set diagonalOfScreenValueTemp to (IBscreenDiagonalValue as string)
set fmt to current application's NSNumberFormatter's alloc()'s init()
tell fmt to setFormat_("#,##0.00")
set diagonalOfScreenValue to fmt's numberFromString_(diagonalOfScreenValueTemp)
What I need is a number in the AS world, not the Cocoa one.
The fact that this problem occurs only when there is a formatter attached to the field, I imagine that I have to read it back somehow through some kind of filter, and I thought that this code would do it, but nope.
Anyone has had this problem, or anyone has a lead to the direction I should take?
Thanks alot!
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)