| 1 | '\" |
| 2 | '\" Copyright (c) 1990-1994 The Regents of the University of California. |
| 3 | '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 | '\" Copyright (c) 1998-2000 Scriptics Corporation. |
| 5 | '\" |
| 6 | '\" See the file "license.terms" for information on usage and redistribution |
| 7 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 8 | '\" |
| 9 | '\" RCS: @(#) $Id: entry.n,v 1.11.2.1 2004/10/28 10:19:29 dkf Exp $ |
| 10 | '\" |
| 11 | '\" The definitions below are for supplemental macros used in Tcl/Tk |
| 12 | '\" manual entries. |
| 13 | '\" |
| 14 | '\" .AP type name in/out ?indent? |
| 15 | '\" Start paragraph describing an argument to a library procedure. |
| 16 | '\" type is type of argument (int, etc.), in/out is either "in", "out", |
| 17 | '\" or "in/out" to describe whether procedure reads or modifies arg, |
| 18 | '\" and indent is equivalent to second arg of .IP (shouldn't ever be |
| 19 | '\" needed; use .AS below instead) |
| 20 | '\" |
| 21 | '\" .AS ?type? ?name? |
| 22 | '\" Give maximum sizes of arguments for setting tab stops. Type and |
| 23 | '\" name are examples of largest possible arguments that will be passed |
| 24 | '\" to .AP later. If args are omitted, default tab stops are used. |
| 25 | '\" |
| 26 | '\" .BS |
| 27 | '\" Start box enclosure. From here until next .BE, everything will be |
| 28 | '\" enclosed in one large box. |
| 29 | '\" |
| 30 | '\" .BE |
| 31 | '\" End of box enclosure. |
| 32 | '\" |
| 33 | '\" .CS |
| 34 | '\" Begin code excerpt. |
| 35 | '\" |
| 36 | '\" .CE |
| 37 | '\" End code excerpt. |
| 38 | '\" |
| 39 | '\" .VS ?version? ?br? |
| 40 | '\" Begin vertical sidebar, for use in marking newly-changed parts |
| 41 | '\" of man pages. The first argument is ignored and used for recording |
| 42 | '\" the version when the .VS was added, so that the sidebars can be |
| 43 | '\" found and removed when they reach a certain age. If another argument |
| 44 | '\" is present, then a line break is forced before starting the sidebar. |
| 45 | '\" |
| 46 | '\" .VE |
| 47 | '\" End of vertical sidebar. |
| 48 | '\" |
| 49 | '\" .DS |
| 50 | '\" Begin an indented unfilled display. |
| 51 | '\" |
| 52 | '\" .DE |
| 53 | '\" End of indented unfilled display. |
| 54 | '\" |
| 55 | '\" .SO |
| 56 | '\" Start of list of standard options for a Tk widget. The |
| 57 | '\" options follow on successive lines, in four columns separated |
| 58 | '\" by tabs. |
| 59 | '\" |
| 60 | '\" .SE |
| 61 | '\" End of list of standard options for a Tk widget. |
| 62 | '\" |
| 63 | '\" .OP cmdName dbName dbClass |
| 64 | '\" Start of description of a specific option. cmdName gives the |
| 65 | '\" option's name as specified in the class command, dbName gives |
| 66 | '\" the option's name in the option database, and dbClass gives |
| 67 | '\" the option's class in the option database. |
| 68 | '\" |
| 69 | '\" .UL arg1 arg2 |
| 70 | '\" Print arg1 underlined, then print arg2 normally. |
| 71 | '\" |
| 72 | '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $ |
| 73 | '\" |
| 74 | '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
| 75 | .if t .wh -1.3i ^B |
| 76 | .nr ^l \n(.l |
| 77 | .ad b |
| 78 | '\" # Start an argument description |
| 79 | .de AP |
| 80 | .ie !"\\$4"" .TP \\$4 |
| 81 | .el \{\ |
| 82 | . ie !"\\$2"" .TP \\n()Cu |
| 83 | . el .TP 15 |
| 84 | .\} |
| 85 | .ta \\n()Au \\n()Bu |
| 86 | .ie !"\\$3"" \{\ |
| 87 | \&\\$1 \\fI\\$2\\fP (\\$3) |
| 88 | .\".b |
| 89 | .\} |
| 90 | .el \{\ |
| 91 | .br |
| 92 | .ie !"\\$2"" \{\ |
| 93 | \&\\$1 \\fI\\$2\\fP |
| 94 | .\} |
| 95 | .el \{\ |
| 96 | \&\\fI\\$1\\fP |
| 97 | .\} |
| 98 | .\} |
| 99 | .. |
| 100 | '\" # define tabbing values for .AP |
| 101 | .de AS |
| 102 | .nr )A 10n |
| 103 | .if !"\\$1"" .nr )A \\w'\\$1'u+3n |
| 104 | .nr )B \\n()Au+15n |
| 105 | .\" |
| 106 | .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
| 107 | .nr )C \\n()Bu+\\w'(in/out)'u+2n |
| 108 | .. |
| 109 | .AS Tcl_Interp Tcl_CreateInterp in/out |
| 110 | '\" # BS - start boxed text |
| 111 | '\" # ^y = starting y location |
| 112 | '\" # ^b = 1 |
| 113 | .de BS |
| 114 | .br |
| 115 | .mk ^y |
| 116 | .nr ^b 1u |
| 117 | .if n .nf |
| 118 | .if n .ti 0 |
| 119 | .if n \l'\\n(.lu\(ul' |
| 120 | .if n .fi |
| 121 | .. |
| 122 | '\" # BE - end boxed text (draw box now) |
| 123 | .de BE |
| 124 | .nf |
| 125 | .ti 0 |
| 126 | .mk ^t |
| 127 | .ie n \l'\\n(^lu\(ul' |
| 128 | .el \{\ |
| 129 | .\" Draw four-sided box normally, but don't draw top of |
| 130 | .\" box if the box started on an earlier page. |
| 131 | .ie !\\n(^b-1 \{\ |
| 132 | \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
| 133 | .\} |
| 134 | .el \}\ |
| 135 | \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
| 136 | .\} |
| 137 | .\} |
| 138 | .fi |
| 139 | .br |
| 140 | .nr ^b 0 |
| 141 | .. |
| 142 | '\" # VS - start vertical sidebar |
| 143 | '\" # ^Y = starting y location |
| 144 | '\" # ^v = 1 (for troff; for nroff this doesn't matter) |
| 145 | .de VS |
| 146 | .if !"\\$2"" .br |
| 147 | .mk ^Y |
| 148 | .ie n 'mc \s12\(br\s0 |
| 149 | .el .nr ^v 1u |
| 150 | .. |
| 151 | '\" # VE - end of vertical sidebar |
| 152 | .de VE |
| 153 | .ie n 'mc |
| 154 | .el \{\ |
| 155 | .ev 2 |
| 156 | .nf |
| 157 | .ti 0 |
| 158 | .mk ^t |
| 159 | \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
| 160 | .sp -1 |
| 161 | .fi |
| 162 | .ev |
| 163 | .\} |
| 164 | .nr ^v 0 |
| 165 | .. |
| 166 | '\" # Special macro to handle page bottom: finish off current |
| 167 | '\" # box/sidebar if in box/sidebar mode, then invoked standard |
| 168 | '\" # page bottom macro. |
| 169 | .de ^B |
| 170 | .ev 2 |
| 171 | 'ti 0 |
| 172 | 'nf |
| 173 | .mk ^t |
| 174 | .if \\n(^b \{\ |
| 175 | .\" Draw three-sided box if this is the box's first page, |
| 176 | .\" draw two sides but no top otherwise. |
| 177 | .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
| 178 | .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
| 179 | .\} |
| 180 | .if \\n(^v \{\ |
| 181 | .nr ^x \\n(^tu+1v-\\n(^Yu |
| 182 | \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
| 183 | .\} |
| 184 | .bp |
| 185 | 'fi |
| 186 | .ev |
| 187 | .if \\n(^b \{\ |
| 188 | .mk ^y |
| 189 | .nr ^b 2 |
| 190 | .\} |
| 191 | .if \\n(^v \{\ |
| 192 | .mk ^Y |
| 193 | .\} |
| 194 | .. |
| 195 | '\" # DS - begin display |
| 196 | .de DS |
| 197 | .RS |
| 198 | .nf |
| 199 | .sp |
| 200 | .. |
| 201 | '\" # DE - end display |
| 202 | .de DE |
| 203 | .fi |
| 204 | .RE |
| 205 | .sp |
| 206 | .. |
| 207 | '\" # SO - start of list of standard options |
| 208 | .de SO |
| 209 | .SH "STANDARD OPTIONS" |
| 210 | .LP |
| 211 | .nf |
| 212 | .ta 5.5c 11c |
| 213 | .ft B |
| 214 | .. |
| 215 | '\" # SE - end of list of standard options |
| 216 | .de SE |
| 217 | .fi |
| 218 | .ft R |
| 219 | .LP |
| 220 | See the \\fBoptions\\fR manual entry for details on the standard options. |
| 221 | .. |
| 222 | '\" # OP - start of full description for a single option |
| 223 | .de OP |
| 224 | .LP |
| 225 | .nf |
| 226 | .ta 4c |
| 227 | Command-Line Name: \\fB\\$1\\fR |
| 228 | Database Name: \\fB\\$2\\fR |
| 229 | Database Class: \\fB\\$3\\fR |
| 230 | .fi |
| 231 | .IP |
| 232 | .. |
| 233 | '\" # CS - begin code excerpt |
| 234 | .de CS |
| 235 | .RS |
| 236 | .nf |
| 237 | .ta .25i .5i .75i 1i |
| 238 | .. |
| 239 | '\" # CE - end code excerpt |
| 240 | .de CE |
| 241 | .fi |
| 242 | .RE |
| 243 | .. |
| 244 | .de UL |
| 245 | \\$1\l'|0\(ul'\\$2 |
| 246 | .. |
| 247 | .TH entry n 8.3 Tk "Tk Built-In Commands" |
| 248 | .BS |
| 249 | '\" Note: do not modify the .SH NAME line immediately below! |
| 250 | .SH NAME |
| 251 | entry \- Create and manipulate entry widgets |
| 252 | .SH SYNOPSIS |
| 253 | \fBentry\fR \fIpathName \fR?\fIoptions\fR? |
| 254 | .SO |
| 255 | \-background \-highlightthickness \-selectbackground |
| 256 | \-borderwidth \-insertbackground \-selectborderwidth |
| 257 | \-cursor \-insertborderwidth \-selectforeground |
| 258 | \-exportselection \-insertofftime \-takefocus |
| 259 | \-font \-insertontime \-textvariable |
| 260 | \-foreground \-insertwidth \-xscrollcommand |
| 261 | \-highlightbackground \-justify |
| 262 | \-highlightcolor \-relief |
| 263 | .SE |
| 264 | .SH "WIDGET-SPECIFIC OPTIONS" |
| 265 | .VS 8.4 |
| 266 | .OP \-disabledbackground disabledBackground DisabledBackground |
| 267 | Specifies the background color to use when the entry is disabled. If |
| 268 | this option is the empty string, the normal background color is used. |
| 269 | .OP \-disabledforeground disabledForeground DisabledForeground |
| 270 | Specifies the foreground color to use when the entry is disabled. If |
| 271 | this option is the empty string, the normal foreground color is used. |
| 272 | .VE 8.4 |
| 273 | .VS 8.3 |
| 274 | .OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand |
| 275 | Specifies a script to eval when \fBvalidateCommand\fR returns 0. |
| 276 | Setting it to {} disables this feature (the default). The best use |
| 277 | of this option is to set it to \fIbell\fR. See \fBValidation\fR |
| 278 | below for more information. |
| 279 | .VE |
| 280 | .VS 8.4 |
| 281 | .OP \-readonlybackground readonlyBackground ReadonlyBackground |
| 282 | Specifies the background color to use when the entry is readonly. If |
| 283 | this option is the empty string, the normal background color is used. |
| 284 | .VE |
| 285 | .OP \-show show Show |
| 286 | If this option is specified, then the true contents of the entry |
| 287 | are not displayed in the window. |
| 288 | Instead, each character in the entry's value will be displayed as |
| 289 | the first character in the value of this option, such as ``*''. |
| 290 | This is useful, for example, if the entry is to be used to enter |
| 291 | a password. |
| 292 | If characters in the entry are selected and copied elsewhere, the |
| 293 | information copied will be what is displayed, not the true contents |
| 294 | of the entry. |
| 295 | .VS 8.4 |
| 296 | .OP \-state state State |
| 297 | Specifies one of three states for the entry: \fBnormal\fR, |
| 298 | \fBdisabled\fR, or \fBreadonly\fR. If the entry is readonly, then the |
| 299 | value may not be changed using widget commands and no insertion cursor |
| 300 | will be displayed, even if the input focus is in the widget; the |
| 301 | contents of the widget may still be selected. If the entry is |
| 302 | disabled, the value may not be changed, no insertion cursor will be |
| 303 | displayed, the contents will not be selectable, and the entry may |
| 304 | be displayed in a different color, depending on the values of the |
| 305 | \fB-disabledforeground\fR and \fB-disabledbackground\fR options. |
| 306 | .VE 8.4 |
| 307 | .VS 8.3 |
| 308 | .OP \-validate validate Validate |
| 309 | Specifies the mode in which validation should operate: \fBnone\fR, |
| 310 | \fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR. |
| 311 | It defaults to \fBnone\fR. When you want validation, you must explicitly |
| 312 | state which mode you wish to use. See \fBValidation\fR below for more. |
| 313 | .OP "\-validatecommand or \-vcmd" validateCommand ValidateCommand |
| 314 | Specifies a script to eval when you want to validate the input into |
| 315 | the entry widget. Setting it to {} disables this feature (the default). |
| 316 | This command must return a valid Tcl boolean value. If it returns 0 (or |
| 317 | the valid Tcl boolean equivalent) then it means you reject the new edition |
| 318 | and it will not occur and the \fBinvalidCommand\fR will be evaluated if it |
| 319 | is set. If it returns 1, then the new edition occurs. |
| 320 | See \fBValidation\fR below for more information. |
| 321 | .VE |
| 322 | .OP \-width width Width |
| 323 | Specifies an integer value indicating the desired width of the entry window, |
| 324 | in average-size characters of the widget's font. |
| 325 | If the value is less than or equal to zero, the widget picks a |
| 326 | size just large enough to hold its current text. |
| 327 | .BE |
| 328 | |
| 329 | .SH DESCRIPTION |
| 330 | .PP |
| 331 | The \fBentry\fR command creates a new window (given by the |
| 332 | \fIpathName\fR argument) and makes it into an entry widget. |
| 333 | Additional options, described above, may be specified on the |
| 334 | command line or in the option database |
| 335 | to configure aspects of the entry such as its colors, font, |
| 336 | and relief. The \fBentry\fR command returns its |
| 337 | \fIpathName\fR argument. At the time this command is invoked, |
| 338 | there must not exist a window named \fIpathName\fR, but |
| 339 | \fIpathName\fR's parent must exist. |
| 340 | .PP |
| 341 | An entry is a widget that displays a one-line text string and |
| 342 | allows that string to be edited using widget commands described below, which |
| 343 | are typically bound to keystrokes and mouse actions. |
| 344 | When first created, an entry's string is empty. |
| 345 | A portion of the entry may be selected as described below. |
| 346 | If an entry is exporting its selection (see the \fBexportSelection\fR |
| 347 | option), then it will observe the standard X11 protocols for handling the |
| 348 | selection; entry selections are available as type \fBSTRING\fR. |
| 349 | Entries also observe the standard Tk rules for dealing with the |
| 350 | input focus. When an entry has the input focus it displays an |
| 351 | \fIinsertion cursor\fR to indicate where new characters will be |
| 352 | inserted. |
| 353 | .PP |
| 354 | Entries are capable of displaying strings that are too long to |
| 355 | fit entirely within the widget's window. In this case, only a |
| 356 | portion of the string will be displayed; commands described below |
| 357 | may be used to change the view in the window. Entries use |
| 358 | the standard \fBxScrollCommand\fR mechanism for interacting with |
| 359 | scrollbars (see the description of the \fBxScrollCommand\fR option |
| 360 | for details). They also support scanning, as described below. |
| 361 | .SH VALIDATION |
| 362 | .VS 8.3 |
| 363 | .PP |
| 364 | Validation works by setting the \fBvalidateCommand\fR |
| 365 | option to a script which will be evaluated according to the \fBvalidate\fR |
| 366 | option as follows: |
| 367 | .PP |
| 368 | .IP \fBnone\fR 10 |
| 369 | Default. This means no validation will occur. |
| 370 | .IP \fBfocus\fR 10 |
| 371 | \fBvalidateCommand\fR will be called when the entry receives or |
| 372 | loses focus. |
| 373 | .IP \fBfocusin\fR 10 |
| 374 | \fBvalidateCommand\fR will be called when the entry receives focus. |
| 375 | .IP \fBfocusout\fR 10 |
| 376 | \fBvalidateCommand\fR will be called when the entry loses focus. |
| 377 | .IP \fBkey\fR 10 |
| 378 | \fBvalidateCommand\fR will be called when the entry is edited. |
| 379 | .IP \fBall\fR 10 |
| 380 | \fBvalidateCommand\fR will be called for all above conditions. |
| 381 | .PP |
| 382 | It is possible to perform percent substitutions on the \fBvalidateCommand\fR |
| 383 | and \fBinvalidCommand\fR, |
| 384 | just as you would in a \fBbind\fR script. The following substitutions |
| 385 | are recognized: |
| 386 | .PP |
| 387 | .IP \fB%d\fR 5 |
| 388 | Type of action: 1 for \fBinsert\fR, 0 for \fBdelete\fR, |
| 389 | or -1 for focus, forced or textvariable validation. |
| 390 | .IP \fB%i\fR 5 |
| 391 | Index of char string to be inserted/deleted, if any, otherwise -1. |
| 392 | .IP \fB%P\fR 5 |
| 393 | The value of the entry if the edit is allowed. If you are configuring the |
| 394 | entry widget to have a new textvariable, this will be the value of that |
| 395 | textvariable. |
| 396 | .IP \fB%s\fR 5 |
| 397 | The current value of entry prior to editing. |
| 398 | .IP \fB%S\fR 5 |
| 399 | The text string being inserted/deleted, if any, {} otherwise. |
| 400 | .IP \fB%v\fR 5 |
| 401 | The type of validation currently set. |
| 402 | .IP \fB%V\fR 5 |
| 403 | The type of validation that triggered the callback |
| 404 | (key, focusin, focusout, forced). |
| 405 | .IP \fB%W\fR 5 |
| 406 | The name of the entry widget. |
| 407 | .PP |
| 408 | In general, the \fBtextVariable\fR and \fBvalidateCommand\fR can be |
| 409 | dangerous to mix. Any problems have been overcome so that using the |
| 410 | \fBvalidateCommand\fR will not interfere with the traditional behavior of |
| 411 | the entry widget. Using the \fBtextVariable\fR for read-only purposes will |
| 412 | never cause problems. The danger comes when you try set the |
| 413 | \fBtextVariable\fR to something that the \fBvalidateCommand\fR would not |
| 414 | accept, which causes \fBvalidate\fR to become \fInone\fR (the |
| 415 | \fBinvalidCommand\fR will not be triggered). The same happens |
| 416 | when an error occurs evaluating the \fBvalidateCommand\fR. |
| 417 | .PP |
| 418 | Primarily, an error will occur when the \fBvalidateCommand\fR or |
| 419 | \fBinvalidCommand\fR encounters an error in its script while evaluating or |
| 420 | \fBvalidateCommand\fR does not return a valid Tcl boolean value. The |
| 421 | \fBvalidate\fR option will also set itself to \fBnone\fR when you edit the |
| 422 | entry widget from within either the \fBvalidateCommand\fR or the |
| 423 | \fBinvalidCommand\fR. Such editions will override the one that was being |
| 424 | validated. If you wish to edit the entry widget (for example set it to {}) |
| 425 | during validation and still have the \fBvalidate\fR option set, you should |
| 426 | include the command |
| 427 | .CS |
| 428 | after idle {%W config -validate %v} |
| 429 | .CE |
| 430 | in the \fBvalidateCommand\fR or \fBinvalidCommand\fR (whichever one you |
| 431 | were editing the entry widget from). It is also recommended to not set an |
| 432 | associated \fBtextVariable\fR during validation, as that can cause the |
| 433 | entry widget to become out of sync with the \fBtextVariable\fR. |
| 434 | .VE |
| 435 | .SH "WIDGET COMMAND" |
| 436 | .PP |
| 437 | The \fBentry\fR command creates a new Tcl command whose |
| 438 | name is \fIpathName\fR. This command may be used to invoke various |
| 439 | operations on the widget. It has the following general form: |
| 440 | .CS |
| 441 | \fIpathName option \fR?\fIarg arg ...\fR? |
| 442 | .CE |
| 443 | \fIOption\fR and the \fIarg\fRs |
| 444 | determine the exact behavior of the command. |
| 445 | .PP |
| 446 | Many of the widget commands for entries take one or more indices as |
| 447 | arguments. An index specifies a particular character in the entry's |
| 448 | string, in any of the following ways: |
| 449 | .TP 12 |
| 450 | \fInumber\fR |
| 451 | Specifies the character as a numerical index, where 0 corresponds |
| 452 | to the first character in the string. |
| 453 | .TP 12 |
| 454 | \fBanchor\fR |
| 455 | Indicates the anchor point for the selection, which is set with the |
| 456 | \fBselect from\fR and \fBselect adjust\fR widget commands. |
| 457 | .TP 12 |
| 458 | \fBend\fR |
| 459 | Indicates the character just after the last one in the entry's string. |
| 460 | This is equivalent to specifying a numerical index equal to the length |
| 461 | of the entry's string. |
| 462 | .TP 12 |
| 463 | \fBinsert\fR |
| 464 | Indicates the character adjacent to and immediately following the |
| 465 | insertion cursor. |
| 466 | .TP 12 |
| 467 | \fBsel.first\fR |
| 468 | Indicates the first character in the selection. It is an error to |
| 469 | use this form if the selection isn't in the entry window. |
| 470 | .TP 12 |
| 471 | \fBsel.last\fR |
| 472 | Indicates the character just after the last one in the selection. |
| 473 | It is an error to use this form if the selection isn't in the |
| 474 | entry window. |
| 475 | .TP 12 |
| 476 | \fB@\fInumber\fR |
| 477 | In this form, \fInumber\fR is treated as an x-coordinate in the |
| 478 | entry's window; the character spanning that x-coordinate is used. |
| 479 | For example, ``\fB@0\fR'' indicates the left-most character in the |
| 480 | window. |
| 481 | .LP |
| 482 | Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR'' |
| 483 | or ``\fBsel.f\fR''. In general, out-of-range indices are automatically |
| 484 | rounded to the nearest legal value. |
| 485 | .PP |
| 486 | The following commands are possible for entry widgets: |
| 487 | .TP |
| 488 | \fIpathName \fBbbox \fIindex\fR |
| 489 | Returns a list of four numbers describing the bounding box of the |
| 490 | character given by \fIindex\fR. |
| 491 | The first two elements of the list give the x and y coordinates of |
| 492 | the upper-left corner of the screen area covered by the character |
| 493 | (in pixels relative to the widget) and the last two elements give |
| 494 | the width and height of the character, in pixels. |
| 495 | The bounding box may refer to a region outside the visible area |
| 496 | of the window. |
| 497 | .TP |
| 498 | \fIpathName \fBcget\fR \fIoption\fR |
| 499 | Returns the current value of the configuration option given |
| 500 | by \fIoption\fR. |
| 501 | \fIOption\fR may have any of the values accepted by the \fBentry\fR |
| 502 | command. |
| 503 | .TP |
| 504 | \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 505 | Query or modify the configuration options of the widget. |
| 506 | If no \fIoption\fR is specified, returns a list describing all of |
| 507 | the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 508 | information on the format of this list). If \fIoption\fR is specified |
| 509 | with no \fIvalue\fR, then the command returns a list describing the |
| 510 | one named option (this list will be identical to the corresponding |
| 511 | sublist of the value returned if no \fIoption\fR is specified). If |
| 512 | one or more \fIoption\-value\fR pairs are specified, then the command |
| 513 | modifies the given widget option(s) to have the given value(s); in |
| 514 | this case the command returns an empty string. |
| 515 | \fIOption\fR may have any of the values accepted by the \fBentry\fR |
| 516 | command. |
| 517 | .TP |
| 518 | \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR? |
| 519 | Delete one or more elements of the entry. |
| 520 | \fIFirst\fR is the index of the first character to delete, and |
| 521 | \fIlast\fR is the index of the character just after the last |
| 522 | one to delete. |
| 523 | If \fIlast\fR isn't specified it defaults to \fIfirst\fR+1, |
| 524 | i.e. a single character is deleted. |
| 525 | This command returns an empty string. |
| 526 | .TP |
| 527 | \fIpathName \fBget\fR |
| 528 | Returns the entry's string. |
| 529 | .TP |
| 530 | \fIpathName \fBicursor \fIindex\fR |
| 531 | Arrange for the insertion cursor to be displayed just before the character |
| 532 | given by \fIindex\fR. Returns an empty string. |
| 533 | .TP |
| 534 | \fIpathName \fBindex\fI index\fR |
| 535 | Returns the numerical index corresponding to \fIindex\fR. |
| 536 | .TP |
| 537 | \fIpathName \fBinsert \fIindex string\fR |
| 538 | Insert the characters of \fIstring\fR just before the character |
| 539 | indicated by \fIindex\fR. Returns an empty string. |
| 540 | .TP |
| 541 | \fIpathName \fBscan\fR \fIoption args\fR |
| 542 | This command is used to implement scanning on entries. It has |
| 543 | two forms, depending on \fIoption\fR: |
| 544 | .RS |
| 545 | .TP |
| 546 | \fIpathName \fBscan mark \fIx\fR |
| 547 | Records \fIx\fR and the current view in the entry window; used in |
| 548 | conjunction with later \fBscan dragto\fR commands. Typically this |
| 549 | command is associated with a mouse button press in the widget. It |
| 550 | returns an empty string. |
| 551 | .TP |
| 552 | \fIpathName \fBscan dragto \fIx\fR |
| 553 | This command computes the difference between its \fIx\fR argument |
| 554 | and the \fIx\fR argument to the last \fBscan mark\fR command for |
| 555 | the widget. It then adjusts the view left or right by 10 times the |
| 556 | difference in x-coordinates. This command is typically associated |
| 557 | with mouse motion events in the widget, to produce the effect of |
| 558 | dragging the entry at high speed through the window. The return |
| 559 | value is an empty string. |
| 560 | .RE |
| 561 | .TP |
| 562 | \fIpathName \fBselection \fIoption arg\fR |
| 563 | This command is used to adjust the selection within an entry. It |
| 564 | has several forms, depending on \fIoption\fR: |
| 565 | .RS |
| 566 | .TP |
| 567 | \fIpathName \fBselection adjust \fIindex\fR |
| 568 | Locate the end of the selection nearest to the character given by |
| 569 | \fIindex\fR, and adjust that end of the selection to be at \fIindex\fR |
| 570 | (i.e. including but not going beyond \fIindex\fR). The other |
| 571 | end of the selection is made the anchor point for future |
| 572 | \fBselect to\fR commands. If the selection |
| 573 | isn't currently in the entry, then a new selection is created to |
| 574 | include the characters between \fIindex\fR and the most recent |
| 575 | selection anchor point, inclusive. |
| 576 | Returns an empty string. |
| 577 | .TP |
| 578 | \fIpathName \fBselection clear\fR |
| 579 | Clear the selection if it is currently in this widget. If the |
| 580 | selection isn't in this widget then the command has no effect. |
| 581 | Returns an empty string. |
| 582 | .TP |
| 583 | \fIpathName \fBselection from \fIindex\fR |
| 584 | Set the selection anchor point to just before the character |
| 585 | given by \fIindex\fR. Doesn't change the selection. |
| 586 | Returns an empty string. |
| 587 | .TP |
| 588 | \fIpathName \fBselection present\fR |
| 589 | Returns 1 if there is are characters selected in the entry, |
| 590 | 0 if nothing is selected. |
| 591 | .TP |
| 592 | \fIpathName \fBselection range \fIstart\fR \fIend\fR |
| 593 | Sets the selection to include the characters starting with |
| 594 | the one indexed by \fIstart\fR and ending with the one just |
| 595 | before \fIend\fR. |
| 596 | If \fIend\fR refers to the same character as \fIstart\fR or an |
| 597 | earlier one, then the entry's selection is cleared. |
| 598 | .TP |
| 599 | \fIpathName \fBselection to \fIindex\fR |
| 600 | If \fIindex\fR is before the anchor point, set the selection |
| 601 | to the characters from \fIindex\fR up to but not including |
| 602 | the anchor point. |
| 603 | If \fIindex\fR is the same as the anchor point, do nothing. |
| 604 | If \fIindex\fR is after the anchor point, set the selection |
| 605 | to the characters from the anchor point up to but not including |
| 606 | \fIindex\fR. |
| 607 | The anchor point is determined by the most recent \fBselect from\fR |
| 608 | or \fBselect adjust\fR command in this widget. |
| 609 | If the selection isn't in this widget then a new selection is |
| 610 | created using the most recent anchor point specified for the widget. |
| 611 | Returns an empty string. |
| 612 | .RE |
| 613 | .VS 8.3 |
| 614 | .TP |
| 615 | \fIpathName \fBvalidate\fR |
| 616 | This command is used to force an evaluation of the \fBvalidateCommand\fR |
| 617 | independent of the conditions specified by the \fBvalidate\fR option. |
| 618 | This is done by temporarily setting the \fBvalidate\fR option to \fBall\fR. |
| 619 | It returns 0 or 1. |
| 620 | .VE |
| 621 | .TP |
| 622 | \fIpathName \fBxview \fIargs\fR |
| 623 | This command is used to query and change the horizontal position of the |
| 624 | text in the widget's window. It can take any of the following |
| 625 | forms: |
| 626 | .RS |
| 627 | .TP |
| 628 | \fIpathName \fBxview\fR |
| 629 | Returns a list containing two elements. |
| 630 | Each element is a real fraction between 0 and 1; together they describe |
| 631 | the horizontal span that is visible in the window. |
| 632 | For example, if the first element is .2 and the second element is .6, |
| 633 | 20% of the entry's text is off-screen to the left, the middle 40% is visible |
| 634 | in the window, and 40% of the text is off-screen to the right. |
| 635 | These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR |
| 636 | option. |
| 637 | .TP |
| 638 | \fIpathName \fBxview\fR \fIindex\fR |
| 639 | Adjusts the view in the window so that the character given by \fIindex\fR |
| 640 | is displayed at the left edge of the window. |
| 641 | .TP |
| 642 | \fIpathName \fBxview moveto\fI fraction\fR |
| 643 | Adjusts the view in the window so that the character \fIfraction\fR of the |
| 644 | way through the text appears at the left edge of the window. |
| 645 | \fIFraction\fR must be a fraction between 0 and 1. |
| 646 | .TP |
| 647 | \fIpathName \fBxview scroll \fInumber what\fR |
| 648 | This command shifts the view in the window left or right according to |
| 649 | \fInumber\fR and \fIwhat\fR. |
| 650 | \fINumber\fR must be an integer. |
| 651 | \fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation |
| 652 | of one of these. |
| 653 | If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by |
| 654 | \fInumber\fR average-width characters on the display; if it is |
| 655 | \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. |
| 656 | If \fInumber\fR is negative then characters farther to the left |
| 657 | become visible; if it is positive then characters farther to the right |
| 658 | become visible. |
| 659 | .RE |
| 660 | .SH "DEFAULT BINDINGS" |
| 661 | .PP |
| 662 | Tk automatically creates class bindings for entries that give them |
| 663 | the following default behavior. |
| 664 | In the descriptions below, ``word'' refers to a contiguous group |
| 665 | of letters, digits, or ``_'' characters, or any single character |
| 666 | other than these. |
| 667 | .IP [1] |
| 668 | Clicking mouse button 1 positions the insertion cursor |
| 669 | just before the character underneath the mouse cursor, sets the |
| 670 | input focus to this widget, and clears any selection in the widget. |
| 671 | Dragging with mouse button 1 strokes out a selection between |
| 672 | the insertion cursor and the character under the mouse. |
| 673 | .IP [2] |
| 674 | Double-clicking with mouse button 1 selects the word under the mouse |
| 675 | and positions the insertion cursor at the end of the word. |
| 676 | Dragging after a double click will stroke out a selection consisting |
| 677 | of whole words. |
| 678 | .IP [3] |
| 679 | Triple-clicking with mouse button 1 selects all of the text in the |
| 680 | entry and positions the insertion cursor at the end of the line. |
| 681 | .IP [4] |
| 682 | The ends of the selection can be adjusted by dragging with mouse |
| 683 | button 1 while the Shift key is down; this will adjust the end |
| 684 | of the selection that was nearest to the mouse cursor when button |
| 685 | 1 was pressed. |
| 686 | If the button is double-clicked before dragging then the selection |
| 687 | will be adjusted in units of whole words. |
| 688 | .IP [5] |
| 689 | Clicking mouse button 1 with the Control key down will position the |
| 690 | insertion cursor in the entry without affecting the selection. |
| 691 | .IP [6] |
| 692 | If any normal printing characters are typed in an entry, they are |
| 693 | inserted at the point of the insertion cursor. |
| 694 | .IP [7] |
| 695 | The view in the entry can be adjusted by dragging with mouse button 2. |
| 696 | If mouse button 2 is clicked without moving the mouse, the selection |
| 697 | is copied into the entry at the position of the mouse cursor. |
| 698 | .IP [8] |
| 699 | If the mouse is dragged out of the entry on the left or right sides |
| 700 | while button 1 is pressed, the entry will automatically scroll to |
| 701 | make more text visible (if there is more text off-screen on the side |
| 702 | where the mouse left the window). |
| 703 | .IP [9] |
| 704 | The Left and Right keys move the insertion cursor one character to the |
| 705 | left or right; they also clear any selection in the entry and set |
| 706 | the selection anchor. |
| 707 | If Left or Right is typed with the Shift key down, then the insertion |
| 708 | cursor moves and the selection is extended to include the new character. |
| 709 | Control-Left and Control-Right move the insertion cursor by words, and |
| 710 | Control-Shift-Left and Control-Shift-Right move the insertion cursor |
| 711 | by words and also extend the selection. |
| 712 | Control-b and Control-f behave the same as Left and Right, respectively. |
| 713 | Meta-b and Meta-f behave the same as Control-Left and Control-Right, |
| 714 | respectively. |
| 715 | .IP [10] |
| 716 | The Home key, or Control-a, will move the insertion cursor to the |
| 717 | beginning of the entry and clear any selection in the entry. |
| 718 | Shift-Home moves the insertion cursor to the beginning of the entry |
| 719 | and also extends the selection to that point. |
| 720 | .IP [11] |
| 721 | The End key, or Control-e, will move the insertion cursor to the |
| 722 | end of the entry and clear any selection in the entry. |
| 723 | Shift-End moves the cursor to the end and extends the selection |
| 724 | to that point. |
| 725 | .IP [12] |
| 726 | The Select key and Control-Space set the selection anchor to the position |
| 727 | of the insertion cursor. They don't affect the current selection. |
| 728 | Shift-Select and Control-Shift-Space adjust the selection to the |
| 729 | current position of the insertion cursor, selecting from the anchor |
| 730 | to the insertion cursor if there was not any selection previously. |
| 731 | .IP [13] |
| 732 | Control-/ selects all the text in the entry. |
| 733 | .IP [14] |
| 734 | Control-\e clears any selection in the entry. |
| 735 | .IP [15] |
| 736 | The F16 key (labelled Copy on many Sun workstations) or Meta-w |
| 737 | copies the selection in the widget to the clipboard, if there is a selection. |
| 738 | .IP [16] |
| 739 | The F20 key (labelled Cut on many Sun workstations) or Control-w |
| 740 | copies the selection in the widget to the clipboard and deletes |
| 741 | the selection. |
| 742 | If there is no selection in the widget then these keys have no effect. |
| 743 | .IP [17] |
| 744 | The F18 key (labelled Paste on many Sun workstations) or Control-y |
| 745 | inserts the contents of the clipboard at the position of the |
| 746 | insertion cursor. |
| 747 | .IP [18] |
| 748 | The Delete key deletes the selection, if there is one in the entry. |
| 749 | If there is no selection, it deletes the character to the right of |
| 750 | the insertion cursor. |
| 751 | .IP [19] |
| 752 | The BackSpace key and Control-h delete the selection, if there is one |
| 753 | in the entry. |
| 754 | If there is no selection, it deletes the character to the left of |
| 755 | the insertion cursor. |
| 756 | .IP [20] |
| 757 | Control-d deletes the character to the right of the insertion cursor. |
| 758 | .IP [21] |
| 759 | Meta-d deletes the word to the right of the insertion cursor. |
| 760 | .IP [22] |
| 761 | Control-k deletes all the characters to the right of the insertion |
| 762 | cursor. |
| 763 | .IP [23] |
| 764 | Control-t reverses the order of the two characters to the right of |
| 765 | the insertion cursor. |
| 766 | .PP |
| 767 | If the entry is disabled using the \fB\-state\fR option, then the entry's |
| 768 | view can still be adjusted and text in the entry can still be selected, |
| 769 | but no insertion cursor will be displayed and no text modifications will |
| 770 | take place |
| 771 | .VS |
| 772 | except if the entry is linked to a variable using the \fB\-textvariable\fR |
| 773 | option, in which case any changes to the variable are reflected by the |
| 774 | entry whatever the value of its \fB\-state\fR option. |
| 775 | .VE |
| 776 | .PP |
| 777 | The behavior of entries can be changed by defining new bindings for |
| 778 | individual widgets or by redefining the class bindings. |
| 779 | |
| 780 | .SH KEYWORDS |
| 781 | entry, widget |