summaryrefslogtreecommitdiffstats
path: root/doc/button.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/button.n')
-rw-r--r--doc/button.n37
1 files changed, 27 insertions, 10 deletions
diff --git a/doc/button.n b/doc/button.n
index 3ca4c4d..4b655a4 100644
--- a/doc/button.n
+++ b/doc/button.n
@@ -30,7 +30,6 @@ Specifies a Tcl command to associate with the button. This command
is typically invoked when mouse button 1 is released over the button
window.
.OP \-default default Default
-.VS
Specifies one of three states for the default ring: \fBnormal\fR,
\fBactive\fR, or \fBdisabled\fR. In active state, the button is drawn
with the platform specific appearance for a default button. In normal
@@ -41,15 +40,13 @@ the same size. In disabled state, the button is drawn with the
non-default button appearance without leaving space for the default
appearance. The disabled state may result in a smaller button than
the active state.
-.VE
.OP \-height height Height
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.
-.VS 8.4
.OP \-overrelief overRelief OverRelief
Specifies an alternative relief for the button, to be used when the
mouse cursor is over the widget. This option can be used to make
@@ -57,7 +54,6 @@ 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 button.
The empty string is the default value.
-.VE 8.4
.OP \-state state State
Specifies one of three states for the button: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the button is displayed using the
@@ -72,9 +68,11 @@ In this state the \fBdisabledForeground\fR and
.OP \-width width Width
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
+screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR).
+For a text button (no image or with \fB\-compound none\fR) then the width
+specifies how much space in characters to allocate for the text label.
+If the width is negative then this specifies a minimum width.
+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
@@ -159,10 +157,8 @@ default behavior:
.IP [1]
A button activates whenever the mouse passes over it and deactivates
whenever the mouse leaves the button.
-.VS
Under Windows, this binding is only active when mouse button 1 has
been pressed over the button.
-.VE
.IP [2]
A button's relief is changed to sunken whenever mouse button 1 is
pressed over the button, and the relief is restored to its original
@@ -181,5 +177,26 @@ actions occur: the button is completely non-responsive.
The behavior of buttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
+.SH EXAMPLES
+This is the classic Tk
+.QW "Hello, World!"
+demonstration:
+.PP
+.CS
+ \fBbutton\fR .b \-text "Hello, World!" \-command exit
+ pack .b
+.CE
+.PP
+This example demonstrates how to handle button accelerators:
+.PP
+.CS
+ \fBbutton\fR .b1 \-text Hello \-underline 0
+ \fBbutton\fR .b2 \-text World \-underline 0
+ bind . <Key\-h> {.b1 flash; .b1 invoke}
+ bind . <Key\-w> {.b2 flash; .b2 invoke}
+ pack .b1 .b2
+.CE
+.SH "SEE ALSO"
+ttk::button(n)
.SH KEYWORDS
button, widget