home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / languages / tcl / !wtest / wtest < prev   
Encoding:
Text File  |  1996-01-27  |  1.7 KB  |  69 lines

  1. # wtest
  2. # This is a demonstration file giving simple examples of the w commands
  3.  
  4.  
  5. #This loads the standard font and colour names.
  6.  
  7. source {<tcl$Dir>.!Choices}
  8.  
  9.  
  10. #This initialises the w system. "wtest" will be used for the name of the program
  11. # in the Tasks display window
  12. #The sprite file "testsprites" is loaded into a user sprite area from the
  13. # application directory.
  14.  
  15. w_init wtest testsprite
  16.  
  17.  
  18. # Load a library to report errors
  19.  
  20. source {<tcl$Dir>.library.debug}
  21.  
  22.  
  23. # load tests for w_text w_draw w_box
  24.  
  25. source {<wtest$Dir>.texttest}
  26. source {<wtest$Dir>.drawtest}
  27. source {<wtest$Dir>.dboxtest}
  28.  
  29. # Make a dialog box for the info entry on the iconbar menu
  30. # It is called "progInfo"
  31. # Its title is "About this program"
  32. # It has a vertical list of four info boxes displaying text.
  33.  
  34. w_box progInfo create "About this program"\
  35.  { vlist {info Name wtest}
  36.          {info Purpose "w example"}
  37.          {info Author C.T.Stretch}
  38.          {info Version 0.01}
  39.  }
  40.  
  41.  
  42. #Put the "!wtest" icon on the iconbar
  43. #Give it a menu, and a procedure to run if it clicked on.
  44. #The menu has title "wtest".
  45. #It has two entries, one opens the progInfo dialog box created above,
  46. #The other runs the script "exit" if it is clicked on.
  47. #If the icon is clicked the procedure clickproc will be called
  48. #with a string representing the button used
  49.  
  50. w_bar -menu { wtest {Info -dbox progInfo}
  51.                     {Quit -click exit}
  52.             }\
  53.       -click {clickproc %b}
  54.  
  55.  
  56. #This procedure is called when the iconbar icon is clicked on.
  57. # button will be set to "s" if select was used and "a" if alter was used.
  58. # "S"  or "C" will be added if the shift or control keys were held down.
  59.  
  60. proc clickproc {button}\
  61.  { if {$button=="s"} {textopen}
  62.    if {$button=="a"} {drawopen}
  63.    if {$button=="sS"} {boxopen}
  64.  }
  65.  
  66.  
  67.  
  68.  
  69.