Page 1 of 1

setting "numberFormat" for a field?

Posted: Sun Aug 05, 2007 6:16 pm
by homer
I know this sounds like a stupid question. I looked thru the documentation and I couldn't figure out or find a good example.

I have a field where I am putting a value.

I want to set the numberFormat for that value to ^^^^.^^, that is four place holders, a decimal point, and two placeholders after that.

I have another field where I want the numberFormat to be ^^.^^^^

do I put that into a script for the field? how?

do I declare it at the beginning of the stack? how?

assistance is very much appreciated.

homer

Posted: Sun Aug 05, 2007 6:49 pm
by Mark Smith
Homer, I don't think you can set this as a property of a field.

One way to achieve it would be to have a 'dummy setProp' handler in the script of the field:

Code: Select all

setProp formatNumber pNumber
  put format("%07.2f", pNumber) into me
end formatNumber
(that would be "%07.4f" for your other field)

Then, whenever you want to update that field, you'd do this:

Code: Select all

set the formatNumber of fld "theField" to someNumber
Hope this helps,

Mark