| 1 | '\" |
| 2 | '\" Copyright (c) 1996 Sun Microsystems, Inc. |
| 3 | '\" Copyright (c) 1998-2000 Ajuba Solutions. |
| 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: event.n,v 1.6.8.1 2004/10/28 10:19:29 dkf Exp $ |
| 9 | '\" |
| 10 | '\" The definitions below are for supplemental macros used in Tcl/Tk |
| 11 | '\" manual entries. |
| 12 | '\" |
| 13 | '\" .AP type name in/out ?indent? |
| 14 | '\" Start paragraph describing an argument to a library procedure. |
| 15 | '\" type is type of argument (int, etc.), in/out is either "in", "out", |
| 16 | '\" or "in/out" to describe whether procedure reads or modifies arg, |
| 17 | '\" and indent is equivalent to second arg of .IP (shouldn't ever be |
| 18 | '\" needed; use .AS below instead) |
| 19 | '\" |
| 20 | '\" .AS ?type? ?name? |
| 21 | '\" Give maximum sizes of arguments for setting tab stops. Type and |
| 22 | '\" name are examples of largest possible arguments that will be passed |
| 23 | '\" to .AP later. If args are omitted, default tab stops are used. |
| 24 | '\" |
| 25 | '\" .BS |
| 26 | '\" Start box enclosure. From here until next .BE, everything will be |
| 27 | '\" enclosed in one large box. |
| 28 | '\" |
| 29 | '\" .BE |
| 30 | '\" End of box enclosure. |
| 31 | '\" |
| 32 | '\" .CS |
| 33 | '\" Begin code excerpt. |
| 34 | '\" |
| 35 | '\" .CE |
| 36 | '\" End code excerpt. |
| 37 | '\" |
| 38 | '\" .VS ?version? ?br? |
| 39 | '\" Begin vertical sidebar, for use in marking newly-changed parts |
| 40 | '\" of man pages. The first argument is ignored and used for recording |
| 41 | '\" the version when the .VS was added, so that the sidebars can be |
| 42 | '\" found and removed when they reach a certain age. If another argument |
| 43 | '\" is present, then a line break is forced before starting the sidebar. |
| 44 | '\" |
| 45 | '\" .VE |
| 46 | '\" End of vertical sidebar. |
| 47 | '\" |
| 48 | '\" .DS |
| 49 | '\" Begin an indented unfilled display. |
| 50 | '\" |
| 51 | '\" .DE |
| 52 | '\" End of indented unfilled display. |
| 53 | '\" |
| 54 | '\" .SO |
| 55 | '\" Start of list of standard options for a Tk widget. The |
| 56 | '\" options follow on successive lines, in four columns separated |
| 57 | '\" by tabs. |
| 58 | '\" |
| 59 | '\" .SE |
| 60 | '\" End of list of standard options for a Tk widget. |
| 61 | '\" |
| 62 | '\" .OP cmdName dbName dbClass |
| 63 | '\" Start of description of a specific option. cmdName gives the |
| 64 | '\" option's name as specified in the class command, dbName gives |
| 65 | '\" the option's name in the option database, and dbClass gives |
| 66 | '\" the option's class in the option database. |
| 67 | '\" |
| 68 | '\" .UL arg1 arg2 |
| 69 | '\" Print arg1 underlined, then print arg2 normally. |
| 70 | '\" |
| 71 | '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $ |
| 72 | '\" |
| 73 | '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
| 74 | .if t .wh -1.3i ^B |
| 75 | .nr ^l \n(.l |
| 76 | .ad b |
| 77 | '\" # Start an argument description |
| 78 | .de AP |
| 79 | .ie !"\\$4"" .TP \\$4 |
| 80 | .el \{\ |
| 81 | . ie !"\\$2"" .TP \\n()Cu |
| 82 | . el .TP 15 |
| 83 | .\} |
| 84 | .ta \\n()Au \\n()Bu |
| 85 | .ie !"\\$3"" \{\ |
| 86 | \&\\$1 \\fI\\$2\\fP (\\$3) |
| 87 | .\".b |
| 88 | .\} |
| 89 | .el \{\ |
| 90 | .br |
| 91 | .ie !"\\$2"" \{\ |
| 92 | \&\\$1 \\fI\\$2\\fP |
| 93 | .\} |
| 94 | .el \{\ |
| 95 | \&\\fI\\$1\\fP |
| 96 | .\} |
| 97 | .\} |
| 98 | .. |
| 99 | '\" # define tabbing values for .AP |
| 100 | .de AS |
| 101 | .nr )A 10n |
| 102 | .if !"\\$1"" .nr )A \\w'\\$1'u+3n |
| 103 | .nr )B \\n()Au+15n |
| 104 | .\" |
| 105 | .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
| 106 | .nr )C \\n()Bu+\\w'(in/out)'u+2n |
| 107 | .. |
| 108 | .AS Tcl_Interp Tcl_CreateInterp in/out |
| 109 | '\" # BS - start boxed text |
| 110 | '\" # ^y = starting y location |
| 111 | '\" # ^b = 1 |
| 112 | .de BS |
| 113 | .br |
| 114 | .mk ^y |
| 115 | .nr ^b 1u |
| 116 | .if n .nf |
| 117 | .if n .ti 0 |
| 118 | .if n \l'\\n(.lu\(ul' |
| 119 | .if n .fi |
| 120 | .. |
| 121 | '\" # BE - end boxed text (draw box now) |
| 122 | .de BE |
| 123 | .nf |
| 124 | .ti 0 |
| 125 | .mk ^t |
| 126 | .ie n \l'\\n(^lu\(ul' |
| 127 | .el \{\ |
| 128 | .\" Draw four-sided box normally, but don't draw top of |
| 129 | .\" box if the box started on an earlier page. |
| 130 | .ie !\\n(^b-1 \{\ |
| 131 | \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
| 132 | .\} |
| 133 | .el \}\ |
| 134 | \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
| 135 | .\} |
| 136 | .\} |
| 137 | .fi |
| 138 | .br |
| 139 | .nr ^b 0 |
| 140 | .. |
| 141 | '\" # VS - start vertical sidebar |
| 142 | '\" # ^Y = starting y location |
| 143 | '\" # ^v = 1 (for troff; for nroff this doesn't matter) |
| 144 | .de VS |
| 145 | .if !"\\$2"" .br |
| 146 | .mk ^Y |
| 147 | .ie n 'mc \s12\(br\s0 |
| 148 | .el .nr ^v 1u |
| 149 | .. |
| 150 | '\" # VE - end of vertical sidebar |
| 151 | .de VE |
| 152 | .ie n 'mc |
| 153 | .el \{\ |
| 154 | .ev 2 |
| 155 | .nf |
| 156 | .ti 0 |
| 157 | .mk ^t |
| 158 | \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
| 159 | .sp -1 |
| 160 | .fi |
| 161 | .ev |
| 162 | .\} |
| 163 | .nr ^v 0 |
| 164 | .. |
| 165 | '\" # Special macro to handle page bottom: finish off current |
| 166 | '\" # box/sidebar if in box/sidebar mode, then invoked standard |
| 167 | '\" # page bottom macro. |
| 168 | .de ^B |
| 169 | .ev 2 |
| 170 | 'ti 0 |
| 171 | 'nf |
| 172 | .mk ^t |
| 173 | .if \\n(^b \{\ |
| 174 | .\" Draw three-sided box if this is the box's first page, |
| 175 | .\" draw two sides but no top otherwise. |
| 176 | .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 |
| 177 | .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
| 178 | .\} |
| 179 | .if \\n(^v \{\ |
| 180 | .nr ^x \\n(^tu+1v-\\n(^Yu |
| 181 | \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
| 182 | .\} |
| 183 | .bp |
| 184 | 'fi |
| 185 | .ev |
| 186 | .if \\n(^b \{\ |
| 187 | .mk ^y |
| 188 | .nr ^b 2 |
| 189 | .\} |
| 190 | .if \\n(^v \{\ |
| 191 | .mk ^Y |
| 192 | .\} |
| 193 | .. |
| 194 | '\" # DS - begin display |
| 195 | .de DS |
| 196 | .RS |
| 197 | .nf |
| 198 | .sp |
| 199 | .. |
| 200 | '\" # DE - end display |
| 201 | .de DE |
| 202 | .fi |
| 203 | .RE |
| 204 | .sp |
| 205 | .. |
| 206 | '\" # SO - start of list of standard options |
| 207 | .de SO |
| 208 | .SH "STANDARD OPTIONS" |
| 209 | .LP |
| 210 | .nf |
| 211 | .ta 5.5c 11c |
| 212 | .ft B |
| 213 | .. |
| 214 | '\" # SE - end of list of standard options |
| 215 | .de SE |
| 216 | .fi |
| 217 | .ft R |
| 218 | .LP |
| 219 | See the \\fBoptions\\fR manual entry for details on the standard options. |
| 220 | .. |
| 221 | '\" # OP - start of full description for a single option |
| 222 | .de OP |
| 223 | .LP |
| 224 | .nf |
| 225 | .ta 4c |
| 226 | Command-Line Name: \\fB\\$1\\fR |
| 227 | Database Name: \\fB\\$2\\fR |
| 228 | Database Class: \\fB\\$3\\fR |
| 229 | .fi |
| 230 | .IP |
| 231 | .. |
| 232 | '\" # CS - begin code excerpt |
| 233 | .de CS |
| 234 | .RS |
| 235 | .nf |
| 236 | .ta .25i .5i .75i 1i |
| 237 | .. |
| 238 | '\" # CE - end code excerpt |
| 239 | .de CE |
| 240 | .fi |
| 241 | .RE |
| 242 | .. |
| 243 | .de UL |
| 244 | \\$1\l'|0\(ul'\\$2 |
| 245 | .. |
| 246 | .TH event n 8.3 Tk "Tk Built-In Commands" |
| 247 | .BS |
| 248 | '\" Note: do not modify the .SH NAME line immediately below! |
| 249 | .SH NAME |
| 250 | event \- Miscellaneous event facilities: define virtual events and generate events |
| 251 | .SH SYNOPSIS |
| 252 | \fBevent\fI option \fR?\fIarg arg ...\fR? |
| 253 | .BE |
| 254 | |
| 255 | .SH DESCRIPTION |
| 256 | .PP |
| 257 | The \fBevent\fR command provides several facilities for dealing with |
| 258 | window system events, such as defining virtual events and synthesizing |
| 259 | events. The command has several different forms, determined by the |
| 260 | first argument. The following forms are currently supported: |
| 261 | .TP |
| 262 | \fBevent add <<\fIvirtual\fB>>\fI sequence \fR?\fIsequence ...\fR? |
| 263 | Associates the virtual event \fIvirtual\fR with the physical |
| 264 | event sequence(s) given by the \fIsequence\fR arguments, so that |
| 265 | the virtual event will trigger whenever any one of the \fIsequence\fRs |
| 266 | occurs. |
| 267 | \fIVirtual\fR may be any string value and \fIsequence\fR may have |
| 268 | any of the values allowed for the \fIsequence\fR argument to the |
| 269 | \fBbind\fR command. |
| 270 | If \fIvirtual\fR is already defined, the new physical event sequences |
| 271 | add to the existing sequences for the event. |
| 272 | .TP |
| 273 | \fBevent delete <<\fIvirtual\fB>> \fR?\fIsequence\fR \fIsequence ...\fR? |
| 274 | Deletes each of the \fIsequence\fRs from those associated with |
| 275 | the virtual event given by \fIvirtual\fR. |
| 276 | \fIVirtual\fR may be any string value and \fIsequence\fR may have |
| 277 | any of the values allowed for the \fIsequence\fR argument to the |
| 278 | \fBbind\fR command. |
| 279 | Any \fIsequence\fRs not currently associated with \fIvirtual\fR |
| 280 | are ignored. |
| 281 | If no \fIsequence\fR argument is provided, all physical event sequences |
| 282 | are removed for \fIvirtual\fR, so that the virtual event will not |
| 283 | trigger anymore. |
| 284 | .TP |
| 285 | \fBevent generate \fIwindow event \fR?\fIoption value option value ...\fR? |
| 286 | Generates a window event and arranges for it to be processed just as if |
| 287 | it had come from the window system. |
| 288 | \fIWindow\fR gives the path name of the window for which the event |
| 289 | .VS 8.3 |
| 290 | will be generated; it may also be an identifier (such as returned by |
| 291 | \fBwinfo id\fR) as long as it is for a window in the current application. |
| 292 | .VE |
| 293 | \fIEvent\fR provides a basic description of |
| 294 | the event, such as \fB<Shift-Button-2>\fR or \fB<<Paste>>\fR. |
| 295 | If \fIWindow\fR is empty the whole screen is meant, and coordinates |
| 296 | are relative to the screen. |
| 297 | \fIEvent\fR may have any of the forms allowed for the \fIsequence\fR |
| 298 | argument of the \fBbind\fR command except that it must consist |
| 299 | of a single event pattern, not a sequence. |
| 300 | \fIOption-value\fR pairs may be used to specify additional |
| 301 | attributes of the event, such as the x and y mouse position; see |
| 302 | EVENT FIELDS below. If the \fB\-when\fR option is not specified, the |
| 303 | event is processed immediately: all of the handlers for the event |
| 304 | will complete before the \fBevent generate\fR command returns. |
| 305 | If the \fB\-when\fR option is specified then it determines when the |
| 306 | event is processed. Certain events, such as key events, require |
| 307 | that the window has focus to receive the event properly. |
| 308 | .TP |
| 309 | \fBevent info \fR?<<\fIvirtual\fB>>\fR? |
| 310 | Returns information about virtual events. |
| 311 | If the \fB<<\fIvirtual\fB>>\fR argument is omitted, the return value |
| 312 | is a list of all the virtual events that are currently defined. |
| 313 | If \fB<<\fIvirtual\fB>>\fR is specified then the return value is |
| 314 | a list whose elements are the physical event sequences currently |
| 315 | defined for the given virtual event; if the virtual event is |
| 316 | not defined then an empty string is returned. |
| 317 | .SH "EVENT FIELDS" |
| 318 | .PP |
| 319 | The following options are supported for the \fBevent generate\fR |
| 320 | command. These correspond to the ``%'' expansions |
| 321 | allowed in binding scripts for the \fBbind\fR command. |
| 322 | .TP |
| 323 | \fB\-above\fI window\fR |
| 324 | \fIWindow\fR specifies the \fIabove\fR field for the event, |
| 325 | either as a window path name or as an integer window id. |
| 326 | Valid for \fBConfigure\fR events. |
| 327 | Corresponds to the \fB%a\fR substitution for binding scripts. |
| 328 | .TP |
| 329 | \fB\-borderwidth\fI size\fR |
| 330 | \fISize\fR must be a screen distance; it specifies the |
| 331 | \fIborder_width\fR field for the event. |
| 332 | Valid for \fBConfigure\fR events. |
| 333 | Corresponds to the \fB%B\fR substitution for binding scripts. |
| 334 | .TP |
| 335 | \fB\-button\fI number\fR |
| 336 | \fINumber\fR must be an integer; it specifies the \fIdetail\fR field |
| 337 | for a \fBButtonPress\fR or \fBButtonRelease\fR event, overriding |
| 338 | any button number provided in the base \fIevent\fR argument. |
| 339 | Corresponds to the \fB%b\fR substitution for binding scripts. |
| 340 | .TP |
| 341 | \fB\-count\fI number\fR |
| 342 | \fINumber\fR must be an integer; it specifies the \fIcount\fR field |
| 343 | for the event. Valid for \fBExpose\fR events. |
| 344 | Corresponds to the \fB%c\fR substitution for binding scripts. |
| 345 | .TP |
| 346 | \fB\-delta\fI number\fR |
| 347 | \fINumber\fR must be an integer; it specifies the \fIdelta\fR field |
| 348 | for the \fBMouseWheel\fR event. The \fIdelta\fR refers to the |
| 349 | direction and magnitude the mouse wheel was rotated. Note the value |
| 350 | is not a screen distance but are units of motion in the mouse wheel. |
| 351 | Typically these values are multiples of 120. For example, 120 should |
| 352 | scroll the text widget up 4 lines and -240 would scroll the text |
| 353 | widget down 8 lines. Of course, other widgets may define different |
| 354 | behaviors for mouse wheel motion. This field corresponds to the |
| 355 | \fB%D\fR substitution for binding scripts. |
| 356 | .TP |
| 357 | \fB\-detail\fI detail\fR |
| 358 | \fIDetail\fR specifies the \fIdetail\fR field for the event |
| 359 | and must be one of the following: |
| 360 | .RS |
| 361 | .DS |
| 362 | .ta 6c |
| 363 | \fBNotifyAncestor NotifyNonlinearVirtual |
| 364 | NotifyDetailNone NotifyPointer |
| 365 | NotifyInferior NotifyPointerRoot |
| 366 | NotifyNonlinear NotifyVirtual\fR |
| 367 | .DE |
| 368 | Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR and |
| 369 | \fBFocusOut\fR events. |
| 370 | Corresponds to the \fB%d\fR substitution for binding scripts. |
| 371 | .RE |
| 372 | .TP |
| 373 | \fB\-focus\fI boolean\fR |
| 374 | \fIBoolean\fR must be a boolean value; it specifies the \fIfocus\fR |
| 375 | field for the event. |
| 376 | Valid for \fBEnter\fR and \fBLeave\fR events. |
| 377 | Corresponds to the \fB%f\fR substitution for binding scripts. |
| 378 | .TP |
| 379 | \fB\-height\fI size\fR |
| 380 | \fISize\fR must be a screen distance; it specifies the \fIheight\fR |
| 381 | field for the event. Valid for \fBConfigure\fR events. |
| 382 | Corresponds to the \fB%h\fR substitution for binding scripts. |
| 383 | .TP |
| 384 | \fB\-keycode\fI number\fR |
| 385 | \fINumber\fR must be an integer; it specifies the \fIkeycode\fR |
| 386 | field for the event. |
| 387 | Valid for \fBKeyPress\fR and \fBKeyRelease\fR events. |
| 388 | Corresponds to the \fB%k\fR substitution for binding scripts. |
| 389 | .TP |
| 390 | \fB\-keysym\fI name\fR |
| 391 | \fIName\fR must be the name of a valid keysym, such as \fBg\fR, |
| 392 | \fBspace\fR, or \fBReturn\fR; its corresponding |
| 393 | keycode value is used as the \fIkeycode\fR field for event, overriding |
| 394 | any detail specified in the base \fIevent\fR argument. |
| 395 | Valid for \fBKeyPress\fR and \fBKeyRelease\fR events. |
| 396 | Corresponds to the \fB%K\fR substitution for binding scripts. |
| 397 | .TP |
| 398 | \fB\-mode\fI notify\fR |
| 399 | \fINotify\fR specifies the \fImode\fR field for the event and must be |
| 400 | one of \fBNotifyNormal\fR, \fBNotifyGrab\fR, \fBNotifyUngrab\fR, or |
| 401 | \fBNotifyWhileGrabbed\fR. |
| 402 | Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR, and |
| 403 | \fBFocusOut\fR events. |
| 404 | Corresponds to the \fB%m\fR substitution for binding scripts. |
| 405 | .TP |
| 406 | \fB\-override\fI boolean\fR |
| 407 | \fIBoolean\fR must be a boolean value; it specifies the |
| 408 | \fIoverride_redirect\fR field for the event. |
| 409 | Valid for \fBMap\fR, \fBReparent\fR, and \fBConfigure\fR events. |
| 410 | Corresponds to the \fB%o\fR substitution for binding scripts. |
| 411 | .TP |
| 412 | \fB\-place\fI where\fR |
| 413 | \fIWhere\fR specifies the \fIplace\fR field for the event; it must be |
| 414 | either \fBPlaceOnTop\fR or \fBPlaceOnBottom\fR. |
| 415 | Valid for \fBCirculate\fR events. |
| 416 | Corresponds to the \fB%p\fR substitution for binding scripts. |
| 417 | .TP |
| 418 | \fB\-root\fI window\fR |
| 419 | \fIWindow\fR must be either a window path name or an integer window |
| 420 | identifier; it specifies the \fIroot\fR field for the event. |
| 421 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 422 | \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR |
| 423 | events. |
| 424 | Corresponds to the \fB%R\fR substitution for binding scripts. |
| 425 | .TP |
| 426 | \fB\-rootx\fI coord\fR |
| 427 | \fICoord\fR must be a screen distance; it specifies the \fIx_root\fR |
| 428 | field for the event. |
| 429 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 430 | \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR |
| 431 | events. Corresponds to the \fB%X\fR substitution for binding scripts. |
| 432 | .TP |
| 433 | \fB\-rooty\fI coord\fR |
| 434 | \fICoord\fR must be a screen distance; it specifies the \fIy_root\fR |
| 435 | field for the event. |
| 436 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 437 | \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR |
| 438 | events. |
| 439 | Corresponds to the \fB%Y\fR substitution for binding scripts. |
| 440 | .TP |
| 441 | \fB\-sendevent\fI boolean\fR |
| 442 | \fIBoolean\fR must be a boolean value; it specifies the \fIsend_event\fR |
| 443 | field for the event. Valid for all events. Corresponds to the |
| 444 | \fB%E\fR substitution for binding scripts. |
| 445 | .TP |
| 446 | \fB\-serial\fI number\fR |
| 447 | \fINumber\fR must be an integer; it specifies the \fIserial\fR field |
| 448 | for the event. Valid for all events. |
| 449 | Corresponds to the \fB%#\fR substitution for binding scripts. |
| 450 | .TP |
| 451 | \fB\-state\fI state\fR |
| 452 | \fIState\fR specifies the \fIstate\fR field for the event. |
| 453 | For \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 454 | \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events |
| 455 | it must be an integer value. |
| 456 | For \fBVisibility\fR events it must be one of \fBVisibilityUnobscured\fR, |
| 457 | \fBVisibilityPartiallyObscured\fR, or \fBVisibilityFullyObscured\fR. |
| 458 | This option overrides any modifiers such as \fBMeta\fR or \fBControl\fR |
| 459 | specified in the base \fIevent\fR. |
| 460 | Corresponds to the \fB%s\fR substitution for binding scripts. |
| 461 | .TP |
| 462 | \fB\-subwindow\fI window\fR |
| 463 | \fIWindow\fR specifies the \fIsubwindow\fR field for the event, either |
| 464 | as a path name for a Tk widget or as an integer window identifier. |
| 465 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 466 | \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events. |
| 467 | Similar to \fB%S\fR substitution for binding scripts. |
| 468 | .TP |
| 469 | \fB\-time\fI integer\fR |
| 470 | \fIInteger\fR must be an integer value; it specifies the \fItime\fR field |
| 471 | for the event. |
| 472 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 473 | \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR, |
| 474 | and \fBProperty\fR events. |
| 475 | Corresponds to the \fB%t\fR substitution for binding scripts. |
| 476 | .TP |
| 477 | \fB\-warp\fI boolean\fR |
| 478 | \fIboolean\fR must be a boolean value; it specifies whether |
| 479 | the screen pointer should be warped as well. |
| 480 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 481 | \fBButtonRelease\fR, and \fBMotion\fR events. The pointer will |
| 482 | only warp to a window if it is mapped. |
| 483 | .TP |
| 484 | \fB\-width\fI size\fR |
| 485 | \fISize\fR must be a screen distance; it specifies the \fIwidth\fR field |
| 486 | for the event. |
| 487 | Valid for \fBConfigure\fR events. |
| 488 | Corresponds to the \fB%w\fR substitution for binding scripts. |
| 489 | .TP |
| 490 | \fB\-when\fI when\fR |
| 491 | \fIWhen\fR determines when the event will be processed; it must have one |
| 492 | of the following values: |
| 493 | .RS |
| 494 | .IP \fBnow\fR 10 |
| 495 | Process the event immediately, before the command returns. |
| 496 | This also happens if the \fB\-when\fR option is omitted. |
| 497 | .IP \fBtail\fR 10 |
| 498 | Place the event on Tcl's event queue behind any events already |
| 499 | queued for this application. |
| 500 | .IP \fBhead\fR 10 |
| 501 | Place the event at the front of Tcl's event queue, so that it |
| 502 | will be handled before any other events already queued. |
| 503 | .IP \fBmark\fR 10 |
| 504 | Place the event at the front of Tcl's event queue but behind any |
| 505 | other events already queued with \fB\-when mark\fR. |
| 506 | This option is useful when generating a series of events that should |
| 507 | be processed in order but at the front of the queue. |
| 508 | .RE |
| 509 | .TP |
| 510 | \fB\-x\fI coord\fR |
| 511 | \fICoord\fR must be a screen distance; it specifies the \fIx\fR field |
| 512 | for the event. |
| 513 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 514 | \fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR, |
| 515 | \fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR |
| 516 | events. |
| 517 | Corresponds to the \fB%x\fR substitution for binding scripts. |
| 518 | If \fIWindow\fR is empty the coordinate is relative to the |
| 519 | screen, and this option corresponds to the \fB%X\fR substitution |
| 520 | for binding scripts. |
| 521 | .TP |
| 522 | \fB\-y\fI coord\fR |
| 523 | \fICoord\fR must be a screen distance; it specifies the \fIy\fR |
| 524 | field for the event. |
| 525 | Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR, |
| 526 | \fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR, |
| 527 | \fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR |
| 528 | events. |
| 529 | Corresponds to the \fB%y\fR substitution for binding scripts. |
| 530 | If \fIWindow\fR is empty the coordinate is relative to the |
| 531 | screen, and this option corresponds to the \fB%Y\fR substitution |
| 532 | for binding scripts. |
| 533 | .PP |
| 534 | Any options that are not specified when generating an event are filled |
| 535 | with the value 0, except for \fIserial\fR, which is filled with the |
| 536 | next X event serial number. |
| 537 | .SH "VIRTUAL EVENT EXAMPLES" |
| 538 | .PP |
| 539 | In order for a virtual event binding to trigger, two things must |
| 540 | happen. First, the virtual event must be defined with the |
| 541 | \fBevent add\fR command. Second, a binding must be created for |
| 542 | the virtual event with the \fBbind\fR command. |
| 543 | Consider the following virtual event definitions: |
| 544 | .CS |
| 545 | event add <<Paste>> <Control-y> |
| 546 | event add <<Paste>> <Button-2> |
| 547 | event add <<Save>> <Control-X><Control-S> |
| 548 | event add <<Save>> <Shift-F12> |
| 549 | .CE |
| 550 | In the \fBbind\fR command, a virtual event can be bound like any other |
| 551 | builtin event type as follows: |
| 552 | .CS |
| 553 | bind Entry <<Paste>> {%W insert [selection get]} |
| 554 | .CE |
| 555 | The double angle brackets are used to specify that a virtual event is being |
| 556 | bound. If the user types Control-y or presses button 2, or if |
| 557 | a \fB<<Paste>>\fR virtual event is synthesized with \fBevent generate\fR, |
| 558 | then the \fB<<Paste>>\fR binding will be invoked. |
| 559 | .PP |
| 560 | If a virtual binding has the exact same sequence as a separate |
| 561 | physical binding, then the physical binding will take precedence. |
| 562 | Consider the following example: |
| 563 | .CS |
| 564 | event add <<Paste>> <Control-y> <Meta-Control-y> |
| 565 | bind Entry <Control-y> {puts Control-y} |
| 566 | bind Entry <<Paste>> {puts Paste} |
| 567 | .CE |
| 568 | When the user types Control-y the \fB<Control-y>\fR binding |
| 569 | will be invoked, because a physical event is considered |
| 570 | more specific than a virtual event, all other things being equal. |
| 571 | However, when the user types Meta-Control-y the |
| 572 | \fB<<Paste>>\fR binding will be invoked, because the |
| 573 | \fBMeta\fR modifier in the physical pattern associated with the |
| 574 | virtual binding is more specific than the \fB<Control-y\fR> sequence for |
| 575 | the physical event. |
| 576 | .PP |
| 577 | Bindings on a virtual event may be created before the virtual event exists. |
| 578 | Indeed, the virtual event never actually needs to be defined, for instance, |
| 579 | on platforms where the specific virtual event would meaningless or |
| 580 | ungeneratable. |
| 581 | .PP |
| 582 | When a definition of a virtual event changes at run time, all windows |
| 583 | will respond immediately to the new definition. |
| 584 | Starting from the preceding example, if the following code is executed: |
| 585 | .CS |
| 586 | bind <Entry> <Control-y> {} |
| 587 | event add <<Paste>> <Key-F6> |
| 588 | .CE |
| 589 | the behavior will change such in two ways. First, the shadowed |
| 590 | \fB<<Paste>>\fR binding will emerge. |
| 591 | Typing Control-y will no longer invoke the \fB<Control-y>\fR binding, |
| 592 | but instead invoke the virtual event \fB<<Paste>>\fR. Second, |
| 593 | pressing the F6 key will now also invoke the \fB<<Paste>>\fR binding. |
| 594 | |
| 595 | .SH "SEE ALSO" |
| 596 | bind(n) |
| 597 | |
| 598 | .SH KEYWORDS |
| 599 | event, binding, define, handle, virtual event |