home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls088.hpux.Z / tls088.hpux / lib / vtcl / tests / workproc.tcl < prev    next >
Encoding:
Text File  |  1995-07-20  |  1.5 KB  |  83 lines

  1. # CVS $Id: workproc.tcl,v 1.3 1995/02/03 16:55:33 zibi Exp $
  2. global stopA
  3. global stopB
  4.  
  5. set stopA 0
  6. set stopB 0
  7.  
  8. proc explodeCB {cbs} {
  9.     echo "explosion about to occur...\n\n"
  10.     VtRemoveWorkProc 333
  11. }
  12.  
  13. proc quitCB {cbs} {
  14.     VtClose
  15. }
  16.  
  17. proc workCB {data id} {
  18.     global stopA
  19.     global stopB
  20.  
  21.     if {$data == "A" && $stopA == 1} {
  22.     VtRemoveWorkProc $id
  23.     set stopA 0
  24.     }
  25.  
  26.     if {$data == "B" && $stopB == 1} {
  27.     VtRemoveWorkProc $id
  28.     set stopB 0
  29.     }
  30.     
  31.     echo "hello " $data "\n"
  32.     sleep 1
  33. }
  34.  
  35. proc startWorkCB {data cbs} {
  36.     global stopA
  37.     global stopB
  38.  
  39.     set stop$data 0
  40.     VtAddWorkProc "workCB $data"
  41. }
  42.  
  43. proc stopWorkCB {data cbs} {
  44.     global stopA
  45.     global stopB
  46.  
  47.     set stop$data 1
  48. }
  49.  
  50. set ap [VtOpen "test"]
  51.  
  52. set fn [VtStartForm .work]
  53.  
  54. set start [VtPushButton $fn.start \
  55.        -label "Start A" -callback "startWorkCB A"]
  56.  
  57. set stop [VtPushButton $fn.stop \
  58.        -label "Stop A" -callback "stopWorkCB A" \
  59.           -leftSide $start -alignTop $start ]
  60.  
  61.  
  62. set start1 [VtPushButton $fn.start1 \
  63.        -label "Start B" -callback "startWorkCB B"\
  64.           -below $start -leftSide FORM ]
  65.  
  66. set stop1 [VtPushButton $fn.stop1 \
  67.        -label "Stop B" -callback "stopWorkCB B" \
  68.           -leftSide $start1 \
  69.           -alignTop $start1]
  70.  
  71. set explode [VtPushButton $fn.explode \
  72.        -label "This call VtRemoveWorkProc with a bad id"\
  73.            -callback explodeCB \
  74.           -below $start1 -leftSide FORM]
  75.  
  76. VtPushButton $fn.quit \
  77.     -label "Quit" -callback quitCB\
  78.     -below $explode \
  79.  
  80. VtShow $fn
  81.  
  82. VtMainLoop
  83.