home *** CD-ROM | disk | FTP | other *** search
- # Test of the w_box dialog box facilities
-
-
- #Initialise some variables to hold values of dbox icons
-
- set displayvar 0
- set writevar "Writeable"
- set radiovar radio3
-
-
- #We will only use one dbox. This flag will indicate
- # if it is already open.
-
- set boxisopen 0
-
-
- #Create the Dialog box template
- #The three action buttons each have a script attached.
- #The Cancel and OK script return 0. So the box is closed.
- #The Show script returns show, so the box remains open.
- #Note that " OK " is surrounded by spaces. This gives a wider box. The box
- #sizes are suitable for the system font, O and K are wide letters in some
- #other fonts.
-
- w_box box create "W_test Test Box"\
- { vlist {info "info" "text display" }
- {display "display" displayvar}
- {watch "watch" watchvar}
- {write "write" writevar}
- {hlist {option "opt1" opt1 }
- {option "opt2" opt2 }
- {option "opt3" opt3 }
- }
- { box "A box"
- { hlist {radio "radio1" radiovar}
- {radio "radio2" radiovar}
- {radio "radio3" radiovar}
- }
- }
- {sprite !tcl}
- {hlist {action "Cancel" {set boxisopen 0}}
- {action "Show" {showvars;return show}}
- {default " OK " {showvars;set boxisopen 0}}
- }
- }
-
- # This procedure displays the contents of the dbox variables in a text window
-
- proc showvars {}\
- { global displayvar writevar radiovar opt1 opt2 opt3
- show "Dialog box variable"\
- "displayvar = $displayvar"\
- "writevar = $writevar"\
- "radiovar = $radiovar"\
- "opt1=$opt1 opt2=$opt2 opt3=$opt3 "\
- }
-
- #Open the box if it is not already open.
-
- proc boxopen {}\
- { global boxisopen displayvar
- incr displayvar
- if {$boxisopen==0}\
- { w_box box open
- set boxisopen 1
- }
- }
-
- #watchvar will be set to the date at 5 second intervals.
- #As it has a watch component in the dbox this will be updated when it changes.
-
- w_null watching {set watchvar [date];list 5s} 0s
-