home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Programming / Dialog Director 0.6 / Examples / Multi-Dialogs.as < prev    next >
Encoding:
Text File  |  1997-04-16  |  1.2 KB  |  40 lines  |  [TEXT/ToyS]

  1. property theVals : ["one", "two", "three", "four", "five", "six", "seven"]
  2.  
  3. dd install font {name:"Geneva", size:9} with greyscale
  4. MakeDialog()
  5. repeat while (dd count dialogs) > 0
  6.     DoUpdate()
  7.     set i to dd interact with user
  8.     if i = 4 then
  9.     else if i = 1 then
  10.         MakeDialog()
  11.     else if i = 2 then
  12.         dd delete dialog 1
  13.     else if i = 3 then
  14.         exit repeat
  15.     end if
  16. end repeat
  17. dd uninstall
  18.  
  19.  
  20. -- Experiment by swapping: dialog id n <-> dialog n <-> dialog -n
  21. on DoUpdate()
  22.     set s to ": "
  23.     repeat with n from 1 to dd count dialogs
  24.         set s to s & (dd get value of item 4 of dialog id n) & " "
  25.         dd set contents of item 5 of dialog n to "dialog " & n & s
  26.     end repeat
  27. end DoUpdate
  28.  
  29. on MakeDialog()
  30.     set n to dd count dialogs
  31.     set x to 8 + (n mod 3) * 214
  32.     set y to 44 + (n div 3) * 104
  33.     return dd make dialog {bounds:[x, y, x + 196, y + 70], contents:[¬
  34.         {class:push button, name:"Open", bounds:[6, 6, 46, 22], enabled:n < 6}, ¬
  35.         {class:push button, name:"Close", bounds:[56, 6, 96, 22]}, ¬
  36.         {class:push button, name:"Quit", bounds:[106, 6, 146, 22]}, ¬
  37.         {class:text field, value:theVals's item (n + 1), bounds:[10, 30, 70, 42]}, ¬
  38.         {class:static text, contents:"", bounds:[80, 30, 186, 70]} ¬
  39.             ], name:"Dialog " & (ASCII character (n + 65)), style:document window}
  40. end MakeDialog