home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tcl / demos / mkCheck.tcl < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.5 KB  |  36 lines

  1. # mkCheck w
  2. #
  3. # Create a top-level window that displays a bunch of check buttons.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkCheck {{w .c1}} {
  9.     catch {destroy $w}
  10.     toplevel $w
  11.     dpos $w
  12.     wm title $w "Checkbutton demonstration"
  13.     wm iconname $w "Checkbuttons"
  14.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
  15.         -text "Three checkbuttons are displayed below.  If you click on a button, it will toggle the button's selection state and set a Tcl variable to a value indicating the state of the checkbutton.  Click the \"See Variables\" button to see the current values of the variables.  Click the \"OK\" button when you've seen enough."
  16.     frame $w.frame -borderwidth 10
  17.     pack append $w.frame \
  18.     [checkbutton $w.frame.b1 -text "Wipers OK" -variable wipers \
  19.         -relief flat] {top pady 4 expand frame w} \
  20.     [checkbutton $w.frame.b2 -text "Brakes OK" -variable brakes \
  21.         -relief flat] {top pady 4 expand frame w} \
  22.     [checkbutton $w.frame.b3 -text "Driver Sober" -variable sober \
  23.         -relief flat] {top pady 4 expand frame w}
  24.     frame $w.frame2
  25.     pack append $w.frame2 \
  26.     [button $w.frame2.ok -text OK -command "destroy $w"] \
  27.         {left expand fill} \
  28.     [button $w.frame2.vars -text "See Variables" \
  29.         -command "showVars $w.dialog wipers brakes sober"] \
  30.         {left expand fill}
  31.     button $w.ok -text OK -command "destroy $w"
  32.  
  33.     pack append $w $w.msg {top fill} $w.frame {top expand fill} \
  34.         $w.frame2 {bottom fill}
  35. }
  36.