hwtk::labelframe
Container widget with optional label.
Format
hwtk::labelframe - pathName ?option value? …
Description
A labelframe widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget.
Standard Options
- -borderwidth
 - Database name: borderWidth
 - -clientdata
 - Database name: clientData
 - -cursor
 - Database name: cursor
 - -height
 - Database name: height
 - -help
 - Database name: help
 - -helpcommand
 - Database name: helpcommand
 - -relief
 - Database name: relief
 - -takefocus
 - Database name: takeFocus
 - -underline
 - Database name: underline
 - -width
 - Database name: width
 
Widget-Specific Options
- -labelanchor
 - Database name: labelAnchor
 - -labelwidget
 - Database name: labelWidget
 - -padding
 - Database name: padding
 - -relief
 - Database name: relief
 
Widget Command
- pathName configure ?option? ?value option value …?
 - Query or modify the configuration options of the widget. If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
 - pathName cget option
 - Returns the current value of the configuration option given by option.
 - pathName identify element x y
 - Returns the name of the element under the point given by x and y, or an empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget. Some widgets accept other identify subcommands.
 - pathName instate statespec ?script?
 - Test the widget’s state. If script is not specified, returns 1 if the
                            widget state matches statespec and 0 otherwise. If script is specified,
                            equivalent to
                            
if{[pathNameinstatestateSpec]}script - pathName state ?stateSpec?
 - Modify or inquire widget state. If stateSpec is
                            present, sets the widget state: for each flag in
                                stateSpec, sets the corresponding flag or clears it
                            if prefixed by an exclamation point. Returns a new state spec indicating
                            which flags were changed:
                            
will restore pathName to the original state. If stateSpec is not specified, returns a list of the currently-enabled state flags.setchanges[pathNamestatespec]pathNamestate$changes 
Example
set ::activated 0
proc ::EnableButtons {w} {
    foreach child [winfo children $w] {
        if {$child == "$w.cb"} continue
        if {$::activated} {
            $child configure -state normal
        } else {
            $child configure -state disabled
        }
    }
}
hwtk::dialog .d -title "::hwtk::labelframe"
set d [.d recess]
set w [frame $d.f]
pack $w -side bottom -fill both -expand 1
set lf2 [hwtk::labelframe $w.lf2]
hwtk::checkbutton $lf2.cb -text "Advanced options" -variable activated \
    -command "::EnableButtons $lf2"
$lf2 configure -labelwidget $lf2.cb
pack $lf2 -padx 2m
set i 0
foreach str {Option1 Option2 Option3} {
    pack [hwtk::checkbutton $lf2.b$i -text $str] -side top -fill x -pady 2
    incr i
}
::EnableButtons $lf2
pack [hwtk::labelframe $w.lf3 -text "North" -labelanchor n -padding 4]
pack [hwtk::label $w.lf3.label -text "Alaska"]
pack [hwtk::labelframe $w.lf4 -text "South" -labelanchor s -padding 4] -pady 4
pack [hwtk::label $w.lf4.label -text "Texas"]
.d post