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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [doc/] [checkbutton.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: checkbutton.n,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
9
'\"
10
.so man.macros
11
.TH checkbutton 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
checkbutton \- Create and manipulate checkbutton widgets
16
.SH SYNOPSIS
17
\fBcheckbutton\fI pathName \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.  The button's global variable (\fB\-variable\fR option) will
31
be updated before the command is invoked.
32
.OP \-height height Height
33
Specifies a desired height for the button.
34
If an image or bitmap is being displayed in the button then the value is in
35
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
36
for text it is in lines of text.
37
If this option isn't specified, the button's desired height is computed
38
from the size of the image or bitmap or text being displayed in it.
39
.OP \-indicatoron indicatorOn IndicatorOn
40
Specifies whether or not the indicator should be drawn.  Must be a
41
proper boolean value.  If false, the \fBrelief\fR option is
42
ignored and the widget's relief is always sunken if the widget is
43
selected and raised otherwise.
44
.OP \-offvalue offValue Value
45
Specifies value to store in the button's associated variable whenever
46
this button is deselected.  Defaults to ``0''.
47
.OP \-onvalue onValue Value
48
Specifies value to store in the button's associated variable whenever
49
this button is selected.  Defaults to ``1''.
50
.OP \-selectcolor selectColor Background
51
Specifies a background color to use when the button is selected.
52
If \fBindicatorOn\fR is true then the color applies to the indicator.
53
Under Windows, this color is used as the background for the indicator
54
regardless of the select state.
55
If \fBindicatorOn\fR is false, this color is used as the background
56
for the entire widget, in place of \fBbackground\fR or \fBactiveBackground\fR,
57
whenever the widget is selected.
58
If specified as an empty string then no special color is used for
59
displaying when the widget is selected.
60
.OP \-selectimage selectImage SelectImage
61
Specifies an image to display (in place of the \fBimage\fR option)
62
when the checkbutton is selected.
63
This option is ignored unless the \fBimage\fR option has been
64
specified.
65
.OP \-state state State
66
Specifies one of three states for the checkbutton:  \fBnormal\fR, \fBactive\fR,
67
or \fBdisabled\fR.  In normal state the checkbutton is displayed using the
68
\fBforeground\fR and \fBbackground\fR options.  The active state is
69
typically used when the pointer is over the checkbutton.  In active state
70
the checkbutton is displayed using the \fBactiveForeground\fR and
71
\fBactiveBackground\fR options.  Disabled state means that the checkbutton
72
should be insensitive:  the default bindings will refuse to activate
73
the widget and will ignore mouse button presses.
74
In this state the \fBdisabledForeground\fR and
75
\fBbackground\fR options determine how the checkbutton is displayed.
76
.OP \-variable variable Variable
77
Specifies name of global variable to set to indicate whether
78
or not this button is selected.  Defaults to the name of the
79
button within its parent (i.e. the last element of the button
80
window's path name).
81
.OP \-width width Width
82
Specifies a desired width for the button.
83
If an image or bitmap is being displayed in the button then the value is in
84
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
85
for text it is in characters.
86
If this option isn't specified, the button's desired width is computed
87
from the size of the image or bitmap or text being displayed in it.
88
.BE
89
 
90
.SH DESCRIPTION
91
.PP
92
The \fBcheckbutton\fR command creates a new window (given by the
93
\fIpathName\fR argument) and makes it into a checkbutton widget.
94
Additional
95
options, described above, may be specified on the command line
96
or in the option database
97
to configure aspects of the checkbutton such as its colors, font,
98
text, and initial relief.  The \fBcheckbutton\fR command returns its
99
\fIpathName\fR argument.  At the time this command is invoked,
100
there must not exist a window named \fIpathName\fR, but
101
\fIpathName\fR's parent must exist.
102
.PP
103
A checkbutton is a widget
104
that displays a textual string, bitmap or image
105
and a square called an \fIindicator\fR.
106
If text is displayed, it must all be in a single font, but it
107
can occupy multiple lines on the screen (if it contains newlines
108
or if wrapping occurs because of the \fBwrapLength\fR option) and
109
one of the characters may optionally be underlined using the
110
\fBunderline\fR option.
111
A checkbutton has
112
all of the behavior of a simple button, including the
113
following: it can display itself in either of three different
114
ways, according to the \fBstate\fR option;
115
it can be made to appear
116
raised, sunken, or flat; it can be made to flash; and it invokes
117
a Tcl command whenever mouse button 1 is clicked over the
118
checkbutton.
119
.PP
120
In addition, checkbuttons can be \fIselected\fR.
121
If a checkbutton is selected then the indicator is normally
122
.VS
123
drawn with a selected appearance, and
124
a Tcl variable associated with the checkbutton is set to a particular
125
value (normally 1).
126
Under Unix, the indicator is drawn with a sunken relief and a special
127
color.  Under Windows, the indicator is drawn with a check mark inside.
128
If the checkbutton is not selected, then the indicator is drawn with a
129
deselected appearance, and the associated variable is
130
set to a different value (typically 0).
131
Under Unix, the indicator is drawn with a raised relief and no special
132
color.  Under Windows, the indicator is drawn without a check mark inside.
133
.VE
134
By default, the name of the variable associated with a checkbutton is the
135
same as the \fIname\fR used to create the checkbutton.
136
The variable name, and the ``on'' and ``off'' values stored in it,
137
may be modified with options on the command line or in the option
138
database.
139
Configuration options may also be used to modify the way the
140
indicator is displayed (or whether it is displayed at all).
141
By default a checkbutton is configured to select and deselect
142
itself on alternate button clicks.
143
In addition, each checkbutton monitors its associated variable and
144
automatically selects and deselects itself when the variables value
145
changes to and from the button's ``on'' value.
146
 
147
.SH "WIDGET COMMAND"
148
.PP
149
The \fBcheckbutton\fR command creates a new Tcl command whose
150
name is \fIpathName\fR.  This
151
command may be used to invoke various
152
operations on the widget.  It has the following general form:
153
.CS
154
\fIpathName option \fR?\fIarg arg ...\fR?
155
.CE
156
\fIOption\fR and the \fIarg\fRs
157
determine the exact behavior of the command.  The following
158
commands are possible for checkbutton widgets:
159
.TP
160
\fIpathName \fBcget\fR \fIoption\fR
161
Returns the current value of the configuration option given
162
by \fIoption\fR.
163
\fIOption\fR may have any of the values accepted by the \fBcheckbutton\fR
164
command.
165
.TP
166
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
167
Query or modify the configuration options of the widget.
168
If no \fIoption\fR is specified, returns a list describing all of
169
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
170
information on the format of this list).  If \fIoption\fR is specified
171
with no \fIvalue\fR, then the command returns a list describing the
172
one named option (this list will be identical to the corresponding
173
sublist of the value returned if no \fIoption\fR is specified).  If
174
one or more \fIoption\-value\fR pairs are specified, then the command
175
modifies the given widget option(s) to have the given value(s);  in
176
this case the command returns an empty string.
177
\fIOption\fR may have any of the values accepted by the \fBcheckbutton\fR
178
command.
179
.TP
180
\fIpathName \fBdeselect\fR
181
Deselects the checkbutton and sets the associated variable to its ``off''
182
value.
183
.TP
184
\fIpathName \fBflash\fR
185
Flashes the checkbutton.  This is accomplished by redisplaying the checkbutton
186
several times, alternating between active and normal colors.  At
187
the end of the flash the checkbutton is left in the same normal/active
188
state as when the command was invoked.
189
This command is ignored if the checkbutton's state is \fBdisabled\fR.
190
.TP
191
\fIpathName \fBinvoke\fR
192
Does just what would have happened if the user invoked the checkbutton
193
with the mouse: toggle the selection state of the button and invoke
194
the Tcl command associated with the checkbutton, if there is one.
195
The return value is the return value from the Tcl command, or an
196
empty string if there is no command associated with the checkbutton.
197
This command is ignored if the checkbutton's state is \fBdisabled\fR.
198
.TP
199
\fIpathName \fBselect\fR
200
Selects the checkbutton and sets the associated variable to its ``on''
201
value.
202
.TP
203
\fIpathName \fBtoggle\fR
204
Toggles the selection state of the button, redisplaying it and
205
modifying its associated variable to reflect the new state.
206
 
207
.SH BINDINGS
208
.PP
209
Tk automatically creates class bindings for checkbuttons that give them
210
the following default behavior:
211
.VS
212
.IP [1]
213
On Unix systems, a checkbutton activates whenever the mouse passes
214
over it and deactivates whenever the mouse leaves the checkbutton.  On
215
Mac and Windows systems, when mouse button 1 is pressed over a
216
checkbutton, the button activates whenever the mouse pointer is inside
217
the button, and deactivates whenever the mouse pointer leaves the
218
button.
219
.VE
220
.IP [2]
221
When mouse button 1 is pressed over a checkbutton, it is invoked (its
222
selection state toggles and the command associated with the button is
223
invoked, if there is one).
224
.VS
225
.IP [3]
226
When a checkbutton has the input focus, the space key causes the checkbutton
227
to be invoked.  Under Windows, there are additional key bindings; plus
228
(+) and equal (=) select the button, and minus (-) deselects the button.
229
.VE
230
.PP
231
If the checkbutton's state is \fBdisabled\fR then none of the above
232
actions occur:  the checkbutton is completely non-responsive.
233
.PP
234
The behavior of checkbuttons can be changed by defining new bindings for
235
individual widgets or by redefining the class bindings.
236
 
237
.SH KEYWORDS
238
checkbutton, widget

powered by: WebSVN 2.1.0

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