hwtk::statebutton
Widget containing buttons with an accompanying image which will update based on the selection, to show the state of the widget.
Format
hwtk::statebutton - pathName ?option value? …
Standard Options
- -clientdata
- Database name: clientData
- -compound
- Database name: compound
- -cursor
- Database name: cursor
- -help
- Database name: help
- -helpcommand
- Database name: helpcommand
- -image
- Database name: image
- -state
- Database name: state
- -takefocus
- Database name: takeFocus
- -text
- Database name: text
- -textvariable
- Database name: textVariable
- -underline
- Database name: underline
- -width
- Database name: width
Widget Specific Options
- -command
- Database name: command
- -displaystyle
- Database name: displaystyle
- -offvalue
- Database name: offValue
- -onhelp
- Database name: onhelp
- -onimage
- Database name: onimage
- -onvalue
- Database name: onValue
- -padding
- Database name: padding
- -rmbcommand
- Database name: rmbcommand
- -rmbhelp
- Database name: rmbhelp
- -variable
- Database name: variable
Widget Commands
- 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
- pathName invoke
- Invokes the statebutton widget. If the widget is currently selected, sets the -variable to the -offvalue and deselects the widget; otherwise, sets the -variable to the -onvalue. Returns the result of the -command.
- pathName invokermbcommand ?arg arg …?
- Invokes the command associated with a right mouse button (RMB) click on the statebutton widget. Returns the result of the -rmbcommand.
Example
wtk::dialog .dlg -title ::hwtk::statebutton
set w [.dlg recess]
set lf1 [hwtk::labelframe $w.frame1 -borderwidth 10 -text "State"]
pack $lf1 -side top
pack [hwtk::statebutton $lf1.sb -text "Normal" -help "Normal"] -side left -pady 4
pack [hwtk::statebutton $lf1.sb1 -text "Disabled" -state disabled -help "Disabled"] -side left -padx 2
pack [hwtk::statebutton $lf1.sb2 -text "Underline" -underline 1 -help "Underline"] -side left
pack [hwtk::statebutton $lf1.sb3 -image productHyperWorks-24.png -help "Image"] -side left -padx 2
set lf2 [hwtk::labelframe $w.frame -borderwidth 10 -text "Mutually Exclusive"]
pack $lf2 -side top
set ::currentCity "Vienna"
foreach city {Vienna Rome London Paris} {
pack [hwtk::statebutton $lf2.sb$city -text $city -variable ::currentCity \
-onvalue $city \
-help "$city"] -side left -pady 4 -padx 2
}
.dlg post