Update tk to version 8.5.11
[git/jnareb-git.git] / mingw / lib / tk8.5 / demos / labelframe.tcl
blob21d079f6b068cc83126825b1f8d12abb42c7992e
1 # labelframe.tcl --
3 # This demonstration script creates a toplevel window containing
4 # several labelframe widgets.
6 if {![info exists widgetDemo]} {
7 error "This script should be run from the \"widget\" demo."
10 package require Tk
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 ## See Code / Dismiss buttons
27 set btns [addSeeDismiss $w.buttons $w]
28 pack $btns -side bottom -fill x
30 # Demo area
32 frame $w.f
33 pack $w.f -side bottom -fill both -expand 1
34 set w $w.f
36 # A group of radiobuttons in a labelframe
38 labelframe $w.f -text "Value" -padx 2 -pady 2
39 grid $w.f -row 0 -column 0 -pady 2m -padx 2m
41 foreach value {1 2 3 4} {
42 radiobutton $w.f.b$value -text "This is value $value" \
43 -variable lfdummy -value $value
44 pack $w.f.b$value -side top -fill x -pady 2
48 # Using a label window to control a group of options.
50 proc lfEnableButtons {w} {
51 foreach child [winfo children $w] {
52 if {$child == "$w.cb"} continue
53 if {$::lfdummy2} {
54 $child configure -state normal
55 } else {
56 $child configure -state disabled
61 labelframe $w.f2 -pady 2 -padx 2
62 checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \
63 -command "lfEnableButtons $w.f2" -padx 0
64 $w.f2 configure -labelwidget $w.f2.cb
65 grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m
67 set t 0
68 foreach str {Option1 Option2 Option3} {
69 checkbutton $w.f2.b$t -text $str
70 pack $w.f2.b$t -side top -fill x -pady 2
71 incr t
73 lfEnableButtons $w.f2
76 grid columnconfigure $w {0 1} -weight 1