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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [doc/] [entry.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: entry.n,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
9
'\"
10
.so man.macros
11
.TH entry n 4.1 Tk "Tk Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
entry \- Create and manipulate entry widgets
16
.SH SYNOPSIS
17
\fBentry\fR \fIpathName \fR?\fIoptions\fR?
18
.SO
19
\-background    \-highlightbackground   \-insertontime  \-selectforeground
20
\-borderwidth   \-highlightcolor        \-insertwidth   \-takefocus
21
\-cursor        \-highlightthickness    \-justify       \-textvariable
22
\-exportselection       \-insertbackground      \-relief        \-xscrollcommand
23
\-font  \-insertborderwidth     \-selectbackground
24
\-foreground    \-insertofftime \-selectborderwidth
25
.SE
26
.SH "WIDGET-SPECIFIC OPTIONS"
27
.OP \-show show Show
28
If this option is specified, then the true contents of the entry
29
are not displayed in the window.
30
Instead, each character in the entry's value will be displayed as
31
the first character in the value of this option, such as ``*''.
32
This is useful, for example, if the entry is to be used to enter
33
a password.
34
If characters in the entry are selected and copied elsewhere, the
35
information copied will be what is displayed, not the true contents
36
of the entry.
37
.OP \-state state State
38
Specifies one of two states for the entry:  \fBnormal\fR or \fBdisabled\fR.
39
If the entry is disabled then the value may not be changed using widget
40
commands and no insertion cursor will be displayed, even if the input focus is
41
in the widget.
42
.OP \-width width Width
43
Specifies an integer value indicating the desired width of the entry window,
44
in average-size characters of the widget's font.
45
If the value is less than or equal to zero, the widget picks a
46
size just large enough to hold its current text.
47
.BE
48
 
49
.SH DESCRIPTION
50
.PP
51
The \fBentry\fR command creates a new window (given by the
52
\fIpathName\fR argument) and makes it into an entry widget.
53
Additional options, described above, may be specified on the
54
command line or in the option database
55
to configure aspects of the entry such as its colors, font,
56
and relief.  The \fBentry\fR command returns its
57
\fIpathName\fR argument.  At the time this command is invoked,
58
there must not exist a window named \fIpathName\fR, but
59
\fIpathName\fR's parent must exist.
60
.PP
61
An entry is a widget that displays a one-line text string and
62
allows that string to be edited using widget commands described below, which
63
are typically bound to keystrokes and mouse actions.
64
When first created, an entry's string is empty.
65
A portion of the entry may be selected as described below.
66
If an entry is exporting its selection (see the \fBexportSelection\fR
67
option), then it will observe the standard X11 protocols for handling the
68
selection;  entry selections are available as type \fBSTRING\fR.
69
Entries also observe the standard Tk rules for dealing with the
70
input focus.  When an entry has the input focus it displays an
71
\fIinsertion cursor\fR to indicate where new characters will be
72
inserted.
73
.PP
74
Entries are capable of displaying strings that are too long to
75
fit entirely within the widget's window.  In this case, only a
76
portion of the string will be displayed;  commands described below
77
may be used to change the view in the window.  Entries use
78
the standard \fBxScrollCommand\fR mechanism for interacting with
79
scrollbars (see the description of the \fBxScrollCommand\fR option
80
for details).  They also support scanning, as described below.
81
 
82
.SH "WIDGET COMMAND"
83
.PP
84
The \fBentry\fR command creates a new Tcl command whose
85
name is \fIpathName\fR.  This
86
command may be used to invoke various
87
operations on the widget.  It has the following general form:
88
.CS
89
\fIpathName option \fR?\fIarg arg ...\fR?
90
.CE
91
\fIOption\fR and the \fIarg\fRs
92
determine the exact behavior of the command.
93
.PP
94
Many of the widget commands for entries take one or more indices as
95
arguments.  An index specifies a particular character in the entry's
96
string, in any of the following ways:
97
.TP 12
98
\fInumber\fR
99
Specifies the character as a numerical index, where 0 corresponds
100
to the first character in the string.
101
.TP 12
102
\fBanchor\fR
103
Indicates the anchor point for the selection, which is set with the
104
\fBselect from\fR and \fBselect adjust\fR widget commands.
105
.TP 12
106
\fBend\fR
107
Indicates the character just after the last one in the entry's string.
108
This is equivalent to specifying a numerical index equal to the length
109
of the entry's string.
110
.TP 12
111
\fBinsert\fR
112
Indicates the character adjacent to and immediately following the
113
insertion cursor.
114
.TP 12
115
\fBsel.first\fR
116
Indicates the first character in the selection.  It is an error to
117
use this form if the selection isn't in the entry window.
118
.TP 12
119
\fBsel.last\fR
120
Indicates the character just after the last one in the selection.
121
It is an error to use this form if the selection isn't in the
122
entry window.
123
.TP 12
124
\fB@\fInumber\fR
125
In this form, \fInumber\fR is treated as an x-coordinate in the
126
entry's window;  the character spanning that x-coordinate is used.
127
For example, ``\fB@0\fR'' indicates the left-most character in the
128
window.
129
.LP
130
Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR''
131
or ``\fBsel.f\fR''.  In general, out-of-range indices are automatically
132
rounded to the nearest legal value.
133
.PP
134
The following commands are possible for entry widgets:
135
.TP
136
\fIpathName \fBbbox \fIindex\fR
137
Returns a list of four numbers describing the bounding box of the
138
character given by \fIindex\fR.
139
The first two elements of the list give the x and y coordinates of
140
the upper-left corner of the screen area covered by the character
141
(in pixels relative to the widget) and the last two elements give
142
the width and height of the character, in pixels.
143
The bounding box may refer to a region outside the visible area
144
of the window.
145
.TP
146
\fIpathName \fBcget\fR \fIoption\fR
147
Returns the current value of the configuration option given
148
by \fIoption\fR.
149
\fIOption\fR may have any of the values accepted by the \fBentry\fR
150
command.
151
.TP
152
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
153
Query or modify the configuration options of the widget.
154
If no \fIoption\fR is specified, returns a list describing all of
155
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
156
information on the format of this list).  If \fIoption\fR is specified
157
with no \fIvalue\fR, then the command returns a list describing the
158
one named option (this list will be identical to the corresponding
159
sublist of the value returned if no \fIoption\fR is specified).  If
160
one or more \fIoption\-value\fR pairs are specified, then the command
161
modifies the given widget option(s) to have the given value(s);  in
162
this case the command returns an empty string.
163
\fIOption\fR may have any of the values accepted by the \fBentry\fR
164
command.
165
.TP
166
\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
167
Delete one or more elements of the entry.
168
\fIFirst\fR is the index of the first character to delete, and
169
\fIlast\fR is the index of the character just after the last
170
one to delete.
171
If \fIlast\fR isn't specified it defaults to \fIfirst\fR+1,
172
i.e. a single character is deleted.
173
This command returns an empty string.
174
.TP
175
\fIpathName \fBget\fR
176
Returns the entry's string.
177
.TP
178
\fIpathName \fBicursor \fIindex\fR
179
Arrange for the insertion cursor to be displayed just before the character
180
given by \fIindex\fR.  Returns an empty string.
181
.TP
182
\fIpathName \fBindex\fI index\fR
183
Returns the numerical index corresponding to \fIindex\fR.
184
.TP
185
\fIpathName \fBinsert \fIindex string\fR
186
Insert the characters of \fIstring\fR just before the character
187
indicated by \fIindex\fR.  Returns an empty string.
188
.TP
189
\fIpathName \fBscan\fR \fIoption args\fR
190
This command is used to implement scanning on entries.  It has
191
two forms, depending on \fIoption\fR:
192
.RS
193
.TP
194
\fIpathName \fBscan mark \fIx\fR
195
Records \fIx\fR and the current view in the entry window;  used in
196
conjunction with later \fBscan dragto\fR commands.  Typically this
197
command is associated with a mouse button press in the widget.  It
198
returns an empty string.
199
.TP
200
\fIpathName \fBscan dragto \fIx\fR
201
This command computes the difference between its \fIx\fR argument
202
and the \fIx\fR argument to the last \fBscan mark\fR command for
203
the widget.  It then adjusts the view left or right by 10 times the
204
difference in x-coordinates.  This command is typically associated
205
with mouse motion events in the widget, to produce the effect of
206
dragging the entry at high speed through the window.  The return
207
value is an empty string.
208
.RE
209
.TP
210
\fIpathName \fBselection \fIoption arg\fR
211
This command is used to adjust the selection within an entry.  It
212
has several forms, depending on \fIoption\fR:
213
.RS
214
.TP
215
\fIpathName \fBselection adjust \fIindex\fR
216
Locate the end of the selection nearest to the character given by
217
\fIindex\fR, and adjust that end of the selection to be at \fIindex\fR
218
(i.e including but not going beyond \fIindex\fR).  The other
219
end of the selection is made the anchor point for future
220
\fBselect to\fR commands.  If the selection
221
isn't currently in the entry, then a new selection is created to
222
include the characters between \fIindex\fR and the most recent
223
selection anchor point, inclusive.
224
Returns an empty string.
225
.TP
226
\fIpathName \fBselection clear\fR
227
Clear the selection if it is currently in this widget.  If the
228
selection isn't in this widget then the command has no effect.
229
Returns an empty string.
230
.TP
231
\fIpathName \fBselection from \fIindex\fR
232
Set the selection anchor point to just before the character
233
given by \fIindex\fR.  Doesn't change the selection.
234
Returns an empty string.
235
.TP
236
\fIpathName \fBselection present\fR
237
Returns 1 if there is are characters selected in the entry,
238
 
239
.TP
240
\fIpathName \fBselection range \fIstart\fR \fIend\fR
241
Sets the selection to include the characters starting with
242
the one indexed by \fIstart\fR and ending with the one just
243
before \fIend\fR.
244
If \fIend\fR refers to the same character as \fIstart\fR or an
245
earlier one, then the entry's selection is cleared.
246
.TP
247
\fIpathName \fBselection to \fIindex\fR
248
If \fIindex\fR is before the anchor point, set the selection
249
to the characters from \fIindex\fR up to but not including
250
the anchor point.
251
If \fIindex\fR is the same as the anchor point, do nothing.
252
If \fIindex\fR is after the anchor point, set the selection
253
to the characters from the anchor point up to but not including
254
\fIindex\fR.
255
The anchor point is determined by the most recent \fBselect from\fR
256
or \fBselect adjust\fR command in this widget.
257
If the selection isn't in this widget then a new selection is
258
created using the most recent anchor point specified for the widget.
259
Returns an empty string.
260
.RE
261
.TP
262
\fIpathName \fBxview \fIargs\fR
263
This command is used to query and change the horizontal position of the
264
text in the widget's window.  It can take any of the following
265
forms:
266
.RS
267
.TP
268
\fIpathName \fBxview\fR
269
Returns a list containing two elements.
270
Each element is a real fraction between 0 and 1;  together they describe
271
the horizontal span that is visible in the window.
272
For example, if the first element is .2 and the second element is .6,
273
20% of the entry's text is off-screen to the left, the middle 40% is visible
274
in the window, and 40% of the text is off-screen to the right.
275
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
276
option.
277
.TP
278
\fIpathName \fBxview\fR \fIindex\fR
279
Adjusts the view in the window so that the character given by \fIindex\fR
280
is displayed at the left edge of the window.
281
.TP
282
\fIpathName \fBxview moveto\fI fraction\fR
283
Adjusts the view in the window so that the character \fIfraction\fR of the
284
way through the text appears at the left edge of the window.
285
\fIFraction\fR must be a fraction between 0 and 1.
286
.TP
287
\fIpathName \fBxview scroll \fInumber what\fR
288
This command shifts the view in the window left or right according to
289
\fInumber\fR and \fIwhat\fR.
290
\fINumber\fR must be an integer.
291
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
292
of one of these.
293
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
294
\fInumber\fR average-width characters on the display;  if it is
295
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
296
If \fInumber\fR is negative then characters farther to the left
297
become visible;  if it is positive then characters farther to the right
298
become visible.
299
.RE
300
 
301
.SH "DEFAULT BINDINGS"
302
.PP
303
Tk automatically creates class bindings for entries that give them
304
the following default behavior.
305
In the descriptions below, ``word'' refers to a contiguous group
306
of letters, digits, or ``_'' characters, or any single character
307
other than these.
308
.IP [1]
309
Clicking mouse button 1 positions the insertion cursor
310
just before the character underneath the mouse cursor, sets the
311
input focus to this widget, and clears any selection in the widget.
312
Dragging with mouse button 1 strokes out a selection between
313
the insertion cursor and the character under the mouse.
314
.IP [2]
315
Double-clicking with mouse button 1 selects the word under the mouse
316
and positions the insertion cursor at the beginning of the word.
317
Dragging after a double click will stroke out a selection consisting
318
of whole words.
319
.IP [3]
320
Triple-clicking with mouse button 1 selects all of the text in the
321
entry and positions the insertion cursor before the first character.
322
.IP [4]
323
The ends of the selection can be adjusted by dragging with mouse
324
button 1 while the Shift key is down;  this will adjust the end
325
of the selection that was nearest to the mouse cursor when button
326
1 was pressed.
327
If the button is double-clicked before dragging then the selection
328
will be adjusted in units of whole words.
329
.IP [5]
330
Clicking mouse button 1 with the Control key down will position the
331
insertion cursor in the entry without affecting the selection.
332
.IP [6]
333
If any normal printing characters are typed in an entry, they are
334
inserted at the point of the insertion cursor.
335
.IP [7]
336
The view in the entry can be adjusted by dragging with mouse button 2.
337
If mouse button 2 is clicked without moving the mouse, the selection
338
is copied into the entry at the position of the mouse cursor.
339
.IP [8]
340
If the mouse is dragged out of the entry on the left or right sides
341
while button 1 is pressed, the entry will automatically scroll to
342
make more text visible (if there is more text off-screen on the side
343
where the mouse left the window).
344
.IP [9]
345
The Left and Right keys move the insertion cursor one character to the
346
left or right;  they also clear any selection in the entry and set
347
the selection anchor.
348
If Left or Right is typed with the Shift key down, then the insertion
349
cursor moves and the selection is extended to include the new character.
350
Control-Left and Control-Right move the insertion cursor by words, and
351
Control-Shift-Left and Control-Shift-Right move the insertion cursor
352
by words and also extend the selection.
353
Control-b and Control-f behave the same as Left and Right, respectively.
354
Meta-b and Meta-f behave the same as Control-Left and Control-Right,
355
respectively.
356
.IP [10]
357
The Home key, or Control-a, will move the insertion cursor to the
358
beginning of the entry and clear any selection in the entry.
359
Shift-Home moves the insertion cursor to the beginning of the entry
360
and also extends the selection to that point.
361
.IP [11]
362
The End key, or Control-e, will move the insertion cursor to the
363
end of the entry and clear any selection in the entry.
364
Shift-End moves the cursor to the end and extends the selection
365
to that point.
366
.IP [12]
367
The Select key and Control-Space set the selection anchor to the position
368
of the insertion cursor.  They don't affect the current selection.
369
Shift-Select and Control-Shift-Space adjust the selection to the
370
current position of the insertion cursor, selecting from the anchor
371
to the insertion cursor if there was not any selection previously.
372
.IP [13]
373
Control-/ selects all the text in the entry.
374
.IP [14]
375
Control-\e clears any selection in the entry.
376
.IP [15]
377
The F16 key (labelled Copy on many Sun workstations) or Meta-w
378
copies the selection in the widget to the clipboard, if there is a selection.
379
.IP [16]
380
The F20 key (labelled Cut on many Sun workstations) or Control-w
381
copies the selection in the widget to the clipboard and deletes
382
the selection.
383
If there is no selection in the widget then these keys have no effect.
384
.IP [17]
385
The F18 key (labelled Paste on many Sun workstations) or Control-y
386
inserts the contents of the clipboard at the position of the
387
insertion cursor.
388
.IP [18]
389
The Delete key deletes the selection, if there is one in the entry.
390
If there is no selection, it deletes the character to the right of
391
the insertion cursor.
392
.IP [19]
393
The BackSpace key and Control-h delete the selection, if there is one
394
in the entry.
395
If there is no selection, it deletes the character to the left of
396
the insertion cursor.
397
.IP [20]
398
Control-d deletes the character to the right of the insertion cursor.
399
.IP [21]
400
Meta-d deletes the word to the right of the insertion cursor.
401
.IP [22]
402
Control-k deletes all the characters to the right of the insertion
403
cursor.
404
.IP [23]
405
Control-t reverses the order of the two characters to the right of
406
the insertion cursor.
407
.PP
408
If the entry is disabled using the \fB\-state\fR option, then the entry's
409
view can still be adjusted and text in the entry can still be selected,
410
but no insertion cursor will be displayed and no text modifications will
411
take place.
412
.PP
413
The behavior of entries can be changed by defining new bindings for
414
individual widgets or by redefining the class bindings.
415
 
416
.SH KEYWORDS
417
entry, widget

powered by: WebSVN 2.1.0

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