OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [doc/] [button.n] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1990-1994 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: button.n,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
9
'\"
10
.so man.macros
11
.TH button n 4.4 Tk "Tk Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
button \- Create and manipulate button widgets
16
.SH SYNOPSIS
17
\fBbutton\fR \fIpathName \fR?\fIoptions\fR?
18
.SO
19
\-activebackground      \-cursor        \-highlightthickness    \-takefocus
20
\-activeforeground      \-disabledforeground    \-image \-text
21
\-anchor        \-font  \-justify       \-textvariable
22
\-background    \-foreground    \-padx  \-underline
23
\-bitmap        \-highlightbackground   \-pady  \-wraplength
24
\-borderwidth   \-highlightcolor        \-relief
25
.SE
26
.SH "WIDGET-SPECIFIC OPTIONS"
27
.OP \-command command Command
28
Specifies a Tcl command to associate with the button.  This command
29
is typically invoked when mouse button 1 is released over the button
30
window.
31
.OP \-default default Default
32
.VS
33
Specifies one of three states for the default ring: \fBnormal\fR,
34
\fBactive\fR, or \fBdisabled\fR.  In active state, the button is drawn
35
with the platform specific appearance for a default button.  In normal
36
state, the button is drawn with the platform specific appearance for a
37
non-default button, leaving enough space to draw the default button
38
appearance.  The normal and active states will result in buttons of
39
the same size.  In disabled state, the button is drawn with the
40
non-default button appearance without leaving space for the default
41
appearance.  The disabled state may result in a smaller button than
42
the active state.
43
ring.
44
.VE
45
.OP \-height height Height
46
Specifies a desired height for the button.
47
If an image or bitmap is being displayed in the button then the value is in
48
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
49
for text it is in lines of text.
50
If this option isn't specified, the button's desired height is computed
51
from the size of the image or bitmap or text being displayed in it.
52
.OP \-state state State
53
Specifies one of three states for the button:  \fBnormal\fR, \fBactive\fR,
54
or \fBdisabled\fR.  In normal state the button is displayed using the
55
\fBforeground\fR and \fBbackground\fR options.  The active state is
56
typically used when the pointer is over the button.  In active state
57
the button is displayed using the \fBactiveForeground\fR and
58
\fBactiveBackground\fR options.  Disabled state means that the button
59
should be insensitive:  the default bindings will refuse to activate
60
the widget and will ignore mouse button presses.
61
In this state the \fBdisabledForeground\fR and
62
\fBbackground\fR options determine how the button is displayed.
63
.OP \-width width Width
64
Specifies a desired width for the button.
65
If an image or bitmap is being displayed in the button then the value is in
66
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
67
for text it is in characters.
68
If this option isn't specified, the button's desired width is computed
69
from the size of the image or bitmap or text being displayed in it.
70
.BE
71
 
72
.SH DESCRIPTION
73
.PP
74
The \fBbutton\fR command creates a new window (given by the
75
\fIpathName\fR argument) and makes it into a button widget.
76
Additional
77
options, described above, may be specified on the command line
78
or in the option database
79
to configure aspects of the button such as its colors, font,
80
text, and initial relief.  The \fBbutton\fR command returns its
81
\fIpathName\fR argument.  At the time this command is invoked,
82
there must not exist a window named \fIpathName\fR, but
83
\fIpathName\fR's parent must exist.
84
.PP
85
A button is a widget that displays a textual string, bitmap or image.
86
If text is displayed, it must all be in a single font, but it
87
can occupy multiple lines on the screen (if it contains newlines
88
or if wrapping occurs because of the \fBwrapLength\fR option) and
89
one of the characters may optionally be underlined using the
90
\fBunderline\fR option.
91
It can display itself in either of three different ways, according
92
to
93
the \fBstate\fR option;
94
it can be made to appear raised, sunken, or flat;
95
and it can be made to flash.  When a user invokes the
96
button (by pressing mouse button 1 with the cursor over the
97
button), then the Tcl command specified in the \fB\-command\fR
98
option is invoked.
99
 
100
.SH "WIDGET COMMAND"
101
.PP
102
The \fBbutton\fR command creates a new Tcl command whose
103
name is \fIpathName\fR.  This
104
command may be used to invoke various
105
operations on the widget.  It has the following general form:
106
.CS
107
\fIpathName option \fR?\fIarg arg ...\fR?
108
.CE
109
\fIOption\fR and the \fIarg\fRs
110
determine the exact behavior of the command.  The following
111
commands are possible for button widgets:
112
.TP
113
\fIpathName \fBcget\fR \fIoption\fR
114
Returns the current value of the configuration option given
115
by \fIoption\fR.
116
\fIOption\fR may have any of the values accepted by the \fBbutton\fR
117
command.
118
.TP
119
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
120
Query or modify the configuration options of the widget.
121
If no \fIoption\fR is specified, returns a list describing all of
122
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
123
information on the format of this list).  If \fIoption\fR is specified
124
with no \fIvalue\fR, then the command returns a list describing the
125
one named option (this list will be identical to the corresponding
126
sublist of the value returned if no \fIoption\fR is specified).  If
127
one or more \fIoption\-value\fR pairs are specified, then the command
128
modifies the given widget option(s) to have the given value(s);  in
129
this case the command returns an empty string.
130
\fIOption\fR may have any of the values accepted by the \fBbutton\fR
131
command.
132
.TP
133
\fIpathName \fBflash\fR
134
Flash the button.  This is accomplished by redisplaying the button
135
several times, alternating between active and normal colors.  At
136
the end of the flash the button is left in the same normal/active
137
state as when the command was invoked.
138
This command is ignored if the button's state is \fBdisabled\fR.
139
.TP
140
\fIpathName \fBinvoke\fR
141
Invoke the Tcl command associated with the button, if there is one.
142
The return value is the return value from the Tcl command, or an
143
empty string if there is no command associated with the button.
144
This command is ignored if the button's state is \fBdisabled\fR.
145
 
146
.SH "DEFAULT BINDINGS"
147
.PP
148
Tk automatically creates class bindings for buttons that give them
149
default behavior:
150
.IP [1]
151
A button activates whenever the mouse passes over it and deactivates
152
whenever the mouse leaves the button.
153
.VS
154
Under Windows, this binding is only active when mouse button 1 has
155
been pressed over the button.
156
.VE
157
.IP [2]
158
A button's relief is changed to sunken whenever mouse button 1 is
159
pressed over the button, and the relief is restored to its original
160
value when button 1 is later released.
161
.IP [3]
162
If mouse button 1 is pressed over a button and later released over
163
the button, the button is invoked.  However, if the mouse is not
164
over the button when button 1 is released, then no invocation occurs.
165
.IP [4]
166
When a button has the input focus, the space key causes the button
167
to be invoked.
168
.PP
169
If the button's state is \fBdisabled\fR then none of the above
170
actions occur:  the button is completely non-responsive.
171
.PP
172
The behavior of buttons can be changed by defining new bindings for
173
individual widgets or by redefining the class bindings.
174
 
175
.SH KEYWORDS
176
button, widget

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.