Ooops. Late again. My standard numberField  solution is similar to Michael's 
but simpler as it doesn't need to handle  multiple lines. It does, hoever, 
validate pre- rather than post-process and  restores the old value if 
necessary...

local lOldValue

on  openField
put me into lOldValue
end openField

on keyDown  tKey
if (tKey=".") AND ("." is in me) then exit keyDown
else  if (tKey="-") AND (me="") then pass keyDown
else if tKey is in  "0123456789." then pass keyDown
end keyDown

on closeField
set the numberFormat to "0.00"
put line 1 of me into me
if  me is NOT a number then put lOldValue into me
else add 0 to me
end  closeField

/H
FLCo
Home of the Scripter's  Scrapbook
www.FlexibleLearning.com/ssbk.htm  

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to