home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Programming / Dialog Director 0.6 / Examples / Calc Total.as next >
Encoding:
Text File  |  1997-04-11  |  1.5 KB  |  36 lines  |  [TEXT/ToyS]

  1. property calcDialog : {size:[250, 176], name:"Calculate Total", style:movable modal, contents:[¬
  2.     {class:push button, name:"Done", bounds:[180, 115, 240, 135]}, ¬
  3.     {class:push button, name:"Calc.", bounds:[180, 146, 240, 166]}, ¬
  4.     {class:static text, contents:"", bounds:[60, 150, 155, 166]}, ¬
  5.     {class:text field, name:"1995", bounds:[60, 25, 155, 41], value:100, name bounds:[10, 24, 50, 40]}, ¬
  6.     {class:text field, name:"1996", bounds:[60, 50, 155, 66], value:200, name bounds:[10, 50, 50, 66]}, ¬
  7.     {class:text field, name:"1997", bounds:[60, 75, 155, 91], value:300, name bounds:[10, 76, 50, 92]}, ¬
  8.     {class:text field, name:"1998", bounds:[60, 100, 155, 116], value:400, name bounds:[10, 102, 50, 118]}, ¬
  9.     {class:text field, name:"1999", bounds:[60, 125, 155, 141], value:500, name bounds:[10, 128, 50, 144]}, ¬
  10.     {class:static text, contents:"Year", bounds:[10, 4, 50, 20]}, ¬
  11.     {class:static text, contents:"Amount", bounds:[60, 4, 200, 20]}, ¬
  12.     {class:static text, contents:"Total", bounds:[10, 150, 50, 166]}, ¬
  13.     {class:group box, bounds:[60, 148, 155, 149]}, ¬
  14.     {class:group box, bounds:[60, 166, 155, 166]} ¬
  15.         ], default:2}
  16.  
  17. dd install with greyscale
  18. set d to dd make dialog calcDialog
  19. DoCalc(d)
  20. repeat
  21.     set i to dd interact with user
  22.     if i = 1 then exit repeat
  23.     if i = 2 then DoCalc(d)
  24. end repeat
  25. dd uninstall
  26.  
  27. on DoCalc(d)
  28.     set tot to 0
  29.     repeat with i from 4 to 8
  30.         try
  31.             set tot to tot + (dd get value of item i of d) as number
  32.         on error
  33.         end try
  34.     end repeat
  35.     dd set contents of item 3 of d to tot
  36. end DoCalc