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."
15 wm title
$w "Labelframe Demonstration"
16 wm iconname
$w "labelframe"
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."
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
37 pack $w.f
-side bottom
-fill both
-expand 1
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
58 $child configure
-state normal
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
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
80 grid columnconfigure
$w {0 1} -weight 1