Add a script to clean up after Tcl/Tk installation
[git/jnareb-git.git] / mingw / lib / tk8.5 / demos / labelframe.tcl
blob65411b1a25c563c165e0694795348671b7aa1b0e
1 # labelframe.tcl --
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."
12 package require Tk
14 set w .labelframe
15 catch {destroy $w}
16 toplevel $w
17 wm title $w "Labelframe Demonstration"
18 wm iconname $w "labelframe"
19 positionWindow $w
21 # Some information
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."
26 pack $w.msg -side top
28 ## See Code / Dismiss buttons
29 set btns [addSeeDismiss $w.buttons $w]
30 pack $btns -side bottom -fill x
32 # Demo area
34 frame $w.f
35 pack $w.f -side bottom -fill both -expand 1
36 set w $w.f
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
55 if {$::lfdummy2} {
56 $child configure -state normal
57 } else {
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
69 set t 0
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
73 incr t
75 lfEnableButtons $w.f2
78 grid columnconfigure $w {0 1} -weight 1