Money Script

Charles Szasz cszasz at mac.com
Wed Aug 10 13:15:00 EDT 2011


Bob,

I am using that script along with the following script, which is placed first. The script below prevents a negative number being entered. My app calculates mileage and hence, I will not have a negative number.

on keyDown theKey
   if theKey is in "1234567890" then
      pass keydown
   end if
   if theKey="." and "." is not in me then
      if me is empty or the number of chars of me=1 and char 1 of me="-" then
         put "0." after me
      else
         pass keydown
      end if
   end if
end keyDown


I then use the following scripts:

on backSpaceKey
   put empty into me
end backSpaceKey

on backSpaceKey
   put empty into me
end backSpaceKey

on closeField
   if me <> empty
   then
      put me into tNum
      if char 1 of tNum = "$"
      then
         delete char 1 of tNum
         put format("$%1.2f", tNum) into me
      else
         put format("$%1.2f", tNum) into me
      end if
      
      put field "expen1" into t1
      put filterThis(t1) into tFiltered1
      
      put field "expen2" into t2
      put filterThis(t2) into tFiltered2
end closeField

I am using Nicolas Cuato's scripts for filtering out the $ sign.  If you need those scripts, please let me know.


Charles Szasz
cszasz at mac.com







More information about the use-livecode mailing list