Add back md5sum, which is required by git tests
[msysgit/historical-msysgit.git] / lib / tk8.4 / demos / labelframe.tcl
blobaf8954b6df1544b3e5ae31d5d420952f980f76a7
1 # labelframe.tcl --
3 # This demonstration script creates a toplevel window containing
4 # several labelframe widgets.
6 # RCS: @(#) $Id: labelframe.tcl,v 1.2 2001/10/30 11:21:50 dkf Exp $
8 if {![info exists widgetDemo]} {
9 error "This script should be run from the \"widget\" demo."
12 set w .labelframe
13 catch {destroy $w}
14 toplevel $w
15 wm title $w "Labelframe Demonstration"
16 wm iconname $w "labelframe"
17 positionWindow $w
19 # Some information
21 label $w.msg -font $font -wraplength 4i -justify left -text "Labelframes are\
22 used to group related widgets together. The label may be either \
23 plain text or another widget."
24 pack $w.msg -side top
26 # The bottom buttons
28 frame $w.buttons
29 pack $w.buttons -side bottom -fill x -pady 2m
30 button $w.buttons.dismiss -text Dismiss -command "destroy $w" -width 15
31 button $w.buttons.code -text "See Code" -command "showCode $w" -width 15
32 pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
34 # Demo area
36 frame $w.f
37 pack $w.f -side bottom -fill both -expand 1
38 set w $w.f
40 # A group of radiobuttons in a labelframe
42 labelframe $w.f -text "Value" -padx 2 -pady 2
43 grid $w.f -row 0 -column 0 -pady 2m -padx 2m
45 foreach value {1 2 3 4} {
46 radiobutton $w.f.b$value -text "This is value $value" \
47 -variable lfdummy -value $value
48 pack $w.f.b$value -side top -fill x -pady 2
52 # Using a label window to control a group of options.
54 proc lfEnableButtons {w} {
55 foreach child [winfo children $w] {
56 if {$child == "$w.cb"} continue
57 if {$::lfdummy2} {
58 $child configure -state normal
59 } else {
60 $child configure -state disabled
65 labelframe $w.f2 -pady 2 -padx 2
66 checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \
67 -command "lfEnableButtons $w.f2" -padx 0
68 $w.f2 configure -labelwidget $w.f2.cb
69 grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m
71 set t 0
72 foreach str {Option1 Option2 Option3} {
73 checkbutton $w.f2.b$t -text $str
74 pack $w.f2.b$t -side top -fill x -pady 2
75 incr t
77 lfEnableButtons $w.f2
80 grid columnconfigure $w {0 1} -weight 1