1# radio.tcl --
2#
3# This demonstration script creates a toplevel window containing
4# several radiobutton widgets.
5#
6# SCCS: @(#) radio.tcl 1.4 96/02/16 10:49:34
7
8set w .radio
9catch {destroy $w}
10toplevel $w
11wm title $w "Radiobutton Demonstration"
12wm iconname $w "radio"
13positionWindow $w
14label $w.msg -font $font -wraplength 5i -justify left -text "Two groups of radiobuttons are displayed below.  If you click on a button then the button will become selected exclusively among all the buttons in its group.  A Tcl variable is associated with each group to indicate which of the group's buttons is selected.  Click the \"See Variables\" button to see the current values of the variables."
15pack $w.msg -side top
16
17frame $w.buttons
18pack $w.buttons -side bottom -fill x -pady 2m
19button $w.buttons.dismiss -text Dismiss -command "destroy $w"
20button $w.buttons.code -text "See Code" -command "showCode $w"
21button $w.buttons.vars -text "See Variables"  \
22	-command "showVars $w.dialog size color"
23pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
24
25frame $w.left
26frame $w.right
27pack $w.left $w.right -side left -expand yes  -pady .5c -padx .5c
28
29foreach i {10 12 18 24} {
30    radiobutton $w.left.b$i -text "Point Size $i" -variable size \
31	    -relief flat -value $i
32    pack $w.left.b$i  -side top -pady 2 -anchor w
33}
34
35foreach color {Red Green Blue Yellow Orange Purple} {
36    set lower [string tolower $color]
37    radiobutton $w.right.$lower -text $color -variable color \
38	    -relief flat -value $lower
39    pack $w.right.$lower -side top -pady 2 -anchor w
40}
41