summaryrefslogtreecommitdiffstats
path: root/doc/checkbutton.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/checkbutton.n')
-rw-r--r--doc/checkbutton.n105
1 files changed, 70 insertions, 35 deletions
diff --git a/doc/checkbutton.n b/doc/checkbutton.n
index f236de2..1e05c96 100644
--- a/doc/checkbutton.n
+++ b/doc/checkbutton.n
@@ -34,31 +34,34 @@ Specifies a desired height for the button.
If an image or bitmap is being displayed in the button then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in lines of text.
-If this option isn't specified, the button's desired height is computed
+If this option is not specified, the button's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-indicatoron indicatorOn IndicatorOn
Specifies whether or not the indicator should be drawn. Must be a
proper boolean value. If false, the \fBrelief\fR option is
ignored and the widget's relief is always sunken if the widget is
selected and raised otherwise.
-.VS 8.4
.OP \-offrelief offRelief OffRelief
Specifies the relief for the checkbutton when the indicator is not drawn and
-the checkbutton is off. The default value is "raised". By setting this option
-to "flat" and setting -indicatoron to false and -overrelief to raised,
-the effect is achieved
+the checkbutton is off. The default value is
+.QW raised .
+By setting this option to
+.QW flat
+and setting \fB\-indicatoron\fR to false and \fB\-overrelief\fR to
+.QW raised ,
+the effect is achieved
of having a flat button that raises on mouse-over and which is
depressed when activated. This is the behavior typically exhibited by
the Bold, Italic, and Underline checkbuttons on the toolbar of a
word-processor, for example.
-.VE 8.4
.OP \-offvalue offValue Value
Specifies value to store in the button's associated variable whenever
-this button is deselected. Defaults to ``0''.
+this button is deselected. Defaults to
+.QW 0 .
.OP \-onvalue onValue Value
Specifies value to store in the button's associated variable whenever
-this button is selected. Defaults to ``1''.
-.VS 8.4
+this button is selected. Defaults to
+.QW 1 .
.OP \-overrelief overRelief OverRelief
Specifies an alternative relief for the checkbutton, to be used when the
mouse cursor is over the widget. This option can be used to make
@@ -66,12 +69,10 @@ toolbar buttons, by configuring \fB\-relief flat \-overrelief
raised\fR. If the value of this option is the empty string, then no
alternative relief is used when the mouse cursor is over the checkbutton.
The empty string is the default value.
-.VE 8.4
.OP \-selectcolor selectColor Background
Specifies a background color to use when the button is selected.
-If \fBindicatorOn\fR is true then the color applies to the indicator.
-Under Windows, this color is used as the background for the indicator
-regardless of the select state.
+If \fBindicatorOn\fR is true then the color is used as the background for
+the indicator regardless of the select state.
If \fBindicatorOn\fR is false, this color is used as the background
for the entire widget, in place of \fBbackground\fR or \fBactiveBackground\fR,
whenever the widget is selected.
@@ -93,6 +94,19 @@ should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
In this state the \fBdisabledForeground\fR and
\fBbackground\fR options determine how the checkbutton is displayed.
+.OP \-tristateimage tristateImage TristateImage
+.VS 8.5
+Specifies an image to display (in place of the \fBimage\fR option)
+when the checkbutton is in tri-state mode.
+This option is ignored unless the \fBimage\fR option has been
+specified.
+.VE 8.5
+.OP \-tristatevalue tristateValue Value
+.VS 8.5
+Specifies the value that causes the checkbutton to display the multi-value
+selection, also known as the tri-state mode. Defaults to
+.QW "" .
+.VE 8.5
.OP \-variable variable Variable
Specifies the name of a global variable to set to indicate whether
or not this button is selected. Defaults to the name of the
@@ -103,10 +117,9 @@ Specifies a desired width for the button.
If an image or bitmap is being displayed in the button then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in characters.
-If this option isn't specified, the button's desired width is computed
+If this option is not specified, the button's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
-
.SH DESCRIPTION
.PP
The \fBcheckbutton\fR command creates a new window (given by the
@@ -139,30 +152,45 @@ checkbutton.
.PP
In addition, checkbuttons can be \fIselected\fR.
If a checkbutton is selected then the indicator is normally
-.VS
drawn with a selected appearance, and
a Tcl variable associated with the checkbutton is set to a particular
value (normally 1).
-Under Unix, the indicator is drawn with a sunken relief and a special
-color. Under Windows, the indicator is drawn with a check mark inside.
+.VS 8.5
+The indicator is drawn with a check mark inside.
If the checkbutton is not selected, then the indicator is drawn with a
deselected appearance, and the associated variable is
set to a different value (typically 0).
-Under Unix, the indicator is drawn with a raised relief and no special
-color. Under Windows, the indicator is drawn without a check mark inside.
-.VE
+The indicator is drawn without a check mark inside. In the special case
+where the variable (if specified) has a value that matches the tristatevalue,
+the indicator is drawn with a tri-state appearance and is in the tri-state
+mode indicating mixed or multiple values. (This is used when the check
+box represents the state of multiple items.)
+The indicator is drawn in a platform dependent manner. Under Unix and
+Windows, the background interior of the box is
+.QW grayed .
+Under Mac, the indicator is drawn with a dash mark inside.
By default, the name of the variable associated with a checkbutton is the
same as the \fIname\fR used to create the checkbutton.
-The variable name, and the ``on'' and ``off'' values stored in it,
-may be modified with options on the command line or in the option
-database.
+The variable name, and the
+.QW on ,
+.QW off
+and
+.QW tristate
+values stored in it, may be modified with options on the command line
+or in the option database.
Configuration options may also be used to modify the way the
indicator is displayed (or whether it is displayed at all).
By default a checkbutton is configured to select and deselect
itself on alternate button clicks.
In addition, each checkbutton monitors its associated variable and
automatically selects and deselects itself when the variables value
-changes to and from the button's ``on'' value.
+changes to and from the button's
+.QW on ,
+.QW off
+and
+.QW tristate
+values.
+.VE 8.5
.SH "WIDGET COMMAND"
.PP
The \fBcheckbutton\fR command creates a new Tcl command whose
@@ -197,7 +225,8 @@ this case the command returns an empty string.
command.
.TP
\fIpathName \fBdeselect\fR
-Deselects the checkbutton and sets the associated variable to its ``off''
+Deselects the checkbutton and sets the associated variable to its
+.QW off
value.
.TP
\fIpathName \fBflash\fR
@@ -216,7 +245,8 @@ empty string if there is no command associated with the checkbutton.
This command is ignored if the checkbutton's state is \fBdisabled\fR.
.TP
\fIpathName \fBselect\fR
-Selects the checkbutton and sets the associated variable to its ``on''
+Selects the checkbutton and sets the associated variable to its
+.QW on
value.
.TP
\fIpathName \fBtoggle\fR
@@ -226,7 +256,6 @@ modifying its associated variable to reflect the new state.
.PP
Tk automatically creates class bindings for checkbuttons that give them
the following default behavior:
-.VS
.IP [1]
On Unix systems, a checkbutton activates whenever the mouse passes
over it and deactivates whenever the mouse leaves the checkbutton. On
@@ -234,26 +263,32 @@ Mac and Windows systems, when mouse button 1 is pressed over a
checkbutton, the button activates whenever the mouse pointer is inside
the button, and deactivates whenever the mouse pointer leaves the
button.
-.VE
.IP [2]
When mouse button 1 is pressed over a checkbutton, it is invoked (its
selection state toggles and the command associated with the button is
invoked, if there is one).
-.VS
.IP [3]
When a checkbutton has the input focus, the space key causes the checkbutton
to be invoked. Under Windows, there are additional key bindings; plus
-(+) and equal (=) select the button, and minus (-) deselects the button.
-.VE
+(+) and equal (=) select the button, and minus (\-) deselects the button.
.PP
If the checkbutton's state is \fBdisabled\fR then none of the above
actions occur: the checkbutton is completely non-responsive.
.PP
The behavior of checkbuttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH EXAMPLE
+This example shows a group of uncoupled checkbuttons.
+.PP
+.CS
+ labelframe .lbl \-text "Steps:"
+ \fBcheckbutton\fR .c1 \-text Lights \-variable lights
+ \fBcheckbutton\fR .c2 \-text Cameras \-variable cameras
+ \fBcheckbutton\fR .c3 \-text Action! \-variable action
+ pack .c1 .c2 .c3 \-in .lbl
+ pack .lbl
+.CE
.SH "SEE ALSO"
-button(n), options(n), radiobutton(n)
-
+button(n), options(n), radiobutton(n), ttk::checkbutton(n)
.SH KEYWORDS
checkbutton, widget