]> git.zerfleddert.de Git - micropolis/blame - src/tk/library/demos/mkRadio.tcl
XINCLUDE: use /usr/X11R6/include everywhere
[micropolis] / src / tk / library / demos / mkRadio.tcl
CommitLineData
6a5fa4e0
MG
1# mkRadio w
2#
3# Create a top-level window that displays a bunch of radio buttons.
4#
5# Arguments:
6# w - Name to use for new top-level window.
7
8proc mkRadio {{w .r1}} {
9 catch {destroy $w}
10 toplevel $w
11 dpos $w
12 wm title $w "Radiobutton Demonstration"
13 wm iconname $w "Radiobuttons"
14 message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
15 -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. Click the \"OK\" button when you've seen enough."
16 frame $w.frame -borderwidth 10
17 pack append $w.frame \
18 [frame $w.frame.left] {left expand} \
19 [frame $w.frame.right] {right expand}
20 pack append $w.frame.left \
21 [radiobutton $w.frame.left.b1 -text "Point Size 10" -variable size \
22 -relief flat -value 10] {top pady 4 frame w} \
23 [radiobutton $w.frame.left.b2 -text "Point Size 12" -variable size \
24 -relief flat -value 12] {top pady 4 frame w} \
25 [radiobutton $w.frame.left.b3 -text "Point Size 18" -variable size \
26 -relief flat -value 18] {top pady 4 frame w} \
27 [radiobutton $w.frame.left.b4 -text "Point Size 24" -variable size \
28 -relief flat -value 24] {top pady 4 frame w}
29 pack append $w.frame.right \
30 [radiobutton $w.frame.right.b1 -text "Red" -variable color \
31 -relief flat -value red] {top pady 4 frame w} \
32 [radiobutton $w.frame.right.b2 -text "Green" -variable color \
33 -relief flat -value green] {top pady 4 frame w} \
34 [radiobutton $w.frame.right.b3 -text "Blue" -variable color \
35 -relief flat -value blue] {top pady 4 frame w} \
36 [radiobutton $w.frame.right.b4 -text "Yellow" -variable color \
37 -relief flat -value yellow] {top pady 4 frame w} \
38 [radiobutton $w.frame.right.b5 -text "Orange" -variable color \
39 -relief flat -value orange] {top pady 4 frame w} \
40 [radiobutton $w.frame.right.b6 -text "Purple" -variable color \
41 -relief flat -value purple] {top pady 4 frame w}
42 frame $w.frame2
43 pack append $w.frame2 \
44 [button $w.frame2.ok -text OK -command "destroy $w"] \
45 {left expand fill} \
46 [button $w.frame2.vars -text "See Variables" \
47 -command "showVars $w.dialog size color"] \
48 {left expand fill}
49 button $w.ok -text OK -command "destroy $w"
50
51 pack append $w $w.msg {top fill} $w.frame {top expand fill} \
52 $w.frame2 {bottom fill}
53}
Impressum, Datenschutz