hwtk::statebutton
A hwtk::statebutton widget is used to show or change a state. It has two states, selected and deselected. The state of the statebutton may be linked to a Tcl variable..
hwtk::statebutton - pathName ?option value? ...
-clientdata, clientData, ClientData
-helpcommand, helpcommand, Command
-textvariable, textvariable, Variable
-underline, underline, Underline
Command-Line Name: -command
Database Name: command
Database Class: Command
Specifies the prefix of a Tcl command to invoke whenever the scale’s value is changed via a widget command. The actual command consists of this option followed by a space and a real number indicating the new value of the scale.
Command-Line Name: -offvalue
Database Name: offValue
Database Class: OffValue
The value to store in the associated -variable when the widget is deselected. Defaults to 0.
Command-Line Name: -onimage
Database Name: onimage
Database Class: Image
The image to be shown when the widget is selected.
Command-Line Name: -onvalue
Database Name: onValue
Database Class: OnValue
The value to store in the associated -variable when the widget is selected. Defaults to 1.
Command-Line Name: -padding
Database Name: padding
Database Class: Pad
Specifies the amount of extra space to add around the outside of the statebutton. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left.
Command-Line Name: -rmbcommand
Database Name: rmbcommand
Database Class: Command
A Tcl script/command to execute whenever the statebutton is clicked with the right mousebutton (RMB).
Command-Line Name: -rmbhelp
Database Name: rmbhelp
Database Class: Help
The tooltip help information for the right mousebutton command specified by -rmbcommand.
Command-Line Name: -variable
Database Name: variable
Database Class: Variable
The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified.
In addition to the standard configure, cget, identify, instate, and state commands, statebutton support the following additional widget commands:
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 mousebutton (RMB) click on the statebutton widget. Returns the result of the -rmbcommand.
# get preview frame
set w [hwtk::demo::getpreviewframe]
hwtk::frame $w.right
grid $w.right
label $w.right.l -text "Label" -bitmap questhead -compound left
$w.right.l configure -width [winfo reqwidth $w.right.l] -compound top
$w.right.l configure -height [winfo reqheight $w.right.l]
foreach a {Top Left Right Bottom} {
set lower [string tolower $a]
hwtk::statebutton $w.right.$lower -text $a -variable align \
-offvalue $lower -onvalue $lower -width 7 \
-command "$w.right.l configure -compound \$align"
}
grid x $w.right.top
grid $w.right.left $w.right.l $w.right.right
grid x $w.right.bottom