3 # This demonstration script creates a toplevel window containing
4 # several labelframe widgets.
6 # RCS: @(#) $Id: labelframe.tcl,v 1.4 2004/12/21 11:56:35 dkf Exp $
8 if {![info exists widgetDemo
]} {
9 error "This script should be run from the \"widget\" demo."
17 wm title
$w "Labelframe Demonstration"
18 wm iconname
$w "labelframe"
23 label $w.msg
-font $font -wraplength 4i
-justify left
-text "Labelframes are\
24 used to group related widgets together. The label may be either \
25 plain text or another widget."
28 ## See Code / Dismiss buttons
29 set btns
[addSeeDismiss
$w.buttons
$w]
30 pack $btns -side bottom
-fill x
35 pack $w.f
-side bottom
-fill both
-expand 1
38 # A group of radiobuttons in a labelframe
40 labelframe $w.f
-text "Value" -padx 2 -pady 2
41 grid $w.f
-row 0 -column 0 -pady 2m
-padx 2m
43 foreach value
{1 2 3 4} {
44 radiobutton $w.f.b
$value -text "This is value $value" \
45 -variable lfdummy
-value $value
46 pack $w.f.b
$value -side top
-fill x
-pady 2
50 # Using a label window to control a group of options.
52 proc lfEnableButtons
{w
} {
53 foreach child
[winfo children
$w] {
54 if {$child == "$w.cb"} continue
56 $child configure
-state normal
58 $child configure
-state disabled
63 labelframe $w.f2
-pady 2 -padx 2
64 checkbutton $w.f2.cb
-text "Use this option." -variable lfdummy2
\
65 -command "lfEnableButtons $w.f2" -padx 0
66 $w.f2 configure
-labelwidget $w.f2.cb
67 grid $w.f2
-row 0 -column 1 -pady 2m
-padx 2m
70 foreach str
{Option1 Option2 Option3
} {
71 checkbutton $w.f2.b
$t -text $str
72 pack $w.f2.b
$t -side top
-fill x
-pady 2
78 grid columnconfigure
$w {0 1} -weight 1