home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: workproc.tcl,v 1.3 1995/02/03 16:55:33 zibi Exp $
- global stopA
- global stopB
-
- set stopA 0
- set stopB 0
-
- proc explodeCB {cbs} {
- echo "explosion about to occur...\n\n"
- VtRemoveWorkProc 333
- }
-
- proc quitCB {cbs} {
- VtClose
- }
-
- proc workCB {data id} {
- global stopA
- global stopB
-
- if {$data == "A" && $stopA == 1} {
- VtRemoveWorkProc $id
- set stopA 0
- }
-
- if {$data == "B" && $stopB == 1} {
- VtRemoveWorkProc $id
- set stopB 0
- }
-
- echo "hello " $data "\n"
- sleep 1
- }
-
- proc startWorkCB {data cbs} {
- global stopA
- global stopB
-
- set stop$data 0
- VtAddWorkProc "workCB $data"
- }
-
- proc stopWorkCB {data cbs} {
- global stopA
- global stopB
-
- set stop$data 1
- }
-
- set ap [VtOpen "test"]
-
- set fn [VtStartForm .work]
-
- set start [VtPushButton $fn.start \
- -label "Start A" -callback "startWorkCB A"]
-
- set stop [VtPushButton $fn.stop \
- -label "Stop A" -callback "stopWorkCB A" \
- -leftSide $start -alignTop $start ]
-
-
- set start1 [VtPushButton $fn.start1 \
- -label "Start B" -callback "startWorkCB B"\
- -below $start -leftSide FORM ]
-
- set stop1 [VtPushButton $fn.stop1 \
- -label "Stop B" -callback "stopWorkCB B" \
- -leftSide $start1 \
- -alignTop $start1]
-
- set explode [VtPushButton $fn.explode \
- -label "This call VtRemoveWorkProc with a bad id"\
- -callback explodeCB \
- -below $start1 -leftSide FORM]
-
- VtPushButton $fn.quit \
- -label "Quit" -callback quitCB\
- -below $explode \
-
- VtShow $fn
-
- VtMainLoop
-