NumberFormat devilry
Posted: Wed Apr 19, 2017 8:42 pm
In a small stack I have two buttons and a field. In one button script:
Not rocket science, I get "6.000". Now in the other button script:
Any char at all in place of that "K" will preserve the three digit decimal. The truncated string does as well. The question is this: what is it about calling a function as opposed to straight inLine code? What goes awry with what I see as a very similar process? I struggled with this for a while before I simply included the quote workaround and moved on.
Craig
Code: Select all
on mouseUp
put "" into fld 1
put 6 into temp
set the numberFormat to "#.000"
put temp + 0 into fld 1
end mouseUp
Code: Select all
on mouseUp
put "" into fld 1
put padThree(6) into fld 1
end mouseUp
function padThree var
set the numberFormat to "#.000"
add 0 to var
--OPPTIONS
return var -- puts 6
return var & "K" --puts 6.000K
return var & quote --puts 6.000"
return char 1 to 5 of var & "K" -- puts 6.000
end padThree
Craig