numberFormat prop

Steve Messimer steve at
Tue Jul 9 15:41:01 EDT 2002


>> Anybody know how to set the decimal precision of a numeric value? I have
>> looked through the docs but I can't seem to find the reference.
> Hi Steve,
> Did you check the numberFormat property?

After thrashing around a bit I did find the numberFormat property on my own.
For some reason I was unable to get it to work correctly.  I think the issue
had to do with how and to what type of container it can be applied. I
presumed that it can be applied to any container.

I tried:

set the numberFormat of fld "myFld" to "00.0" -- (and 00.0 and "##.#") none
of which worked

then I tried:

set the numberFormat of calcHolder to 00.0 -- where calcHolder is a var.
(also tried 00.0 and "##.#") didn't work either

Finally,  I just trunc'd the dang thing and I got pretty much what I was
aiming for. I decided I really didn't need the decimal after all.

put trunc(calcHolder * 100) into fld "myFld"

That having been said it would be nice to see an example of how the
numberFormat should work. :-)  Any examples will be much appreciated.



Stephen R. Messimer
Messimer Computing, Inc
208 1st Ave South
Escanaba, MI 49829

More information about the Use-livecode mailing list