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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996 Sun Microsystems, Inc.
3
'\" Copyright (c) 1998 by Scriptics Corporation.
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.1.1.1 2002-01-16 10:25:48 markom Exp $
9
'\"
10
.so man.macros
11
.TH event n 8.0 Tk "Tk Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
event \- Miscellaneous event facilities: define virtual events and generate events
16
.SH SYNOPSIS
17
\fBevent\fI option \fR?\fIarg arg ...\fR?
18
.BE
19
 
20
.SH DESCRIPTION
21
.PP
22
The \fBevent\fR command provides several facilities for dealing with
23
window system events, such as defining virtual events and synthesizing
24
events.  The command has several different forms, determined by the
25
first argument.  The following forms are currently supported:
26
.TP
27
\fBevent add <<\fIvirtual\fB>>\fI sequence \fR?\fIsequence ...\fR?
28
Associates the virtual event \fIvirtual\fR with the physical
29
event sequence(s) given by the \fIsequence\fR arguments, so that
30
the virtual event will trigger whenever any one of the \fIsequence\fRs
31
occurs.
32
\fIVirtual\fR may be any string value and \fIsequence\fR may have
33
any of the values allowed for the \fIsequence\fR argument to the
34
\fBbind\fR command.
35
If \fIvirtual\fR is already defined, the new physical event sequences
36
add to the existing sequences for the event.
37
.TP
38
\fBevent delete <<\fIvirtual\fB>> \fR?\fIsequence\fR \fIsequence ...\fR?
39
Deletes each of the \fIsequence\fRs from those associated with
40
the virtual event given by \fIvirtual\fR.
41
\fIVirtual\fR may be any string value and \fIsequence\fR may have
42
any of the values allowed for the \fIsequence\fR argument to the
43
\fBbind\fR command.
44
Any \fIsequence\fRs not currently associated with \fIvirtual\fR
45
are ignored.
46
If no \fIsequence\fR argument is provided, all physical event sequences
47
are removed for \fIvirtual\fR, so that the virtual event will not
48
trigger anymore.
49
.TP
50
\fBevent generate \fIwindow event \fR?\fIoption value option value ...\fR?
51
Generates a window event and arranges for it to be processed just as if
52
it had come from the window system.
53
\fIWindow\fR gives the path name of the window for which the event
54
.VS
55
will be generated; it may also be an identifier (such as returned by
56
\fBwinfo id\fR) as long as it is for a window in the current application.
57
.VE
58
\fIEvent\fR provides a basic description of
59
the event, such as \fB\fR or \fB<>\fR.
60
\fIEvent\fR may have any of the forms allowed for the \fIsequence\fR
61
argument of the \fBbind\fR command except that it must consist
62
of a single event pattern, not a sequence.
63
\fIOption-value\fR pairs may be used to specify additional
64
attributes of the event, such as the x and y mouse position;  see
65
EVENT FIELDS below.  If the \fB\-when\fR option is not specified, the
66
event is processed immediately:  all of the handlers for the event
67
will complete before the \fBevent generate\fR command returns.
68
If the \fB\-when\fR option is specified then it determines when the
69
event is processed.
70
.TP
71
\fBevent info \fR?<<\fIvirtual\fB>>\fR?
72
Returns information about virtual events.
73
If the \fB<<\fIvirtual\fB>>\fR argument is omitted, the return value
74
is a list of all the virtual events that are currently defined.
75
If \fB<<\fIvirtual\fB>>\fR is specified then the return value is
76
a list whose elements are the physical event sequences currently
77
defined for the given virtual event;  if the virtual event is
78
not defined then an empty string is returned.
79
 
80
.SH "EVENT FIELDS"
81
.PP
82
The following options are supported for the \fBevent generate\fR
83
command.  These correspond to the ``%'' expansions
84
allowed in binding scripts for the \fBbind\fR command.
85
.TP
86
\fB\-above\fI window\fR
87
\fIWindow\fR specifies the \fIabove\fR field for the event,
88
either as a window path name or as an integer window id.
89
Valid for \fBConfigure\fR events.
90
Corresponds to the \fB%a\fR substitution for binding scripts.
91
.TP
92
\fB\-borderwidth\fI size\fR
93
\fISize\fR must be a screen distance;  it specifies the
94
\fIborder_width\fR field for the event.
95
Valid for \fBConfigure\fR events.
96
Corresponds to the \fB%B\fR substitution for binding scripts.
97
.TP
98
\fB\-button\fI number\fR
99
\fINumber\fR must be an integer;  it specifies the \fIdetail\fR field
100
for a \fBButtonPress\fR or \fBButtonRelease\fR event, overriding
101
any button  number provided in the base \fIevent\fR argument.
102
Corresponds to the \fB%b\fR substitution for binding scripts.
103
.TP
104
\fB\-count\fI number\fR
105
\fINumber\fR must be an integer;  it specifies the \fIcount\fR field
106
for the event.  Valid for \fBExpose\fR events.
107
Corresponds to the \fB%c\fR substitution for binding scripts.
108
.TP
109
\fB\-delta\fI number\fR
110
.VS
111
\fINumber\fR must be an integer;  it specifies the \fIdelta\fR field
112
for the \fBMouseWheel\fR event.  The \fIdelta\fR refers to the
113
direction and magnitude the mouse wheel was rotated.  Note the value
114
is not a screen distance but are units of motion in the mouse wheel.
115
Typically these values are multiples of 120.  For example, 120 should
116
scroll the text widget up 4 lines and -240 would scroll the text
117
widget down 8 lines.  Of course, other widgets may define different
118
behaviors for mouse wheel motion.  This field corresponds to the
119
\fB%D\fR substitution for binding scripts.
120
.VE
121
.TP
122
\fB\-detail\fI detail\fR
123
\fIDetail\fR specifies the \fIdetail\fR field for the event
124
and must be one of the following:
125
.RS
126
.DS
127
.ta 6c
128
\fBNotifyAncestor       NotifyNonlinearVirtual
129
NotifyDetailNone        NotifyPointer
130
NotifyInferior  NotifyPointerRoot
131
NotifyNonlinear NotifyVirtual\fR
132
.DE
133
Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR and
134
\fBFocusOut\fR events.
135
Corresponds to the \fB%d\fR substitution for binding scripts.
136
.RE
137
.TP
138
\fB\-focus\fI boolean\fR
139
\fIBoolean\fR must be a boolean value;  it specifies the \fIfocus\fR
140
field for the event.
141
Valid for \fBEnter\fR and \fBLeave\fR events.
142
Corresponds to the \fB%f\fR substitution for binding scripts.
143
.TP
144
\fB\-height\fI size\fR
145
\fISize\fR must be a screen distance;  it specifies the \fIheight\fR
146
field for the event.  Valid for \fBConfigure\fR events.
147
Corresponds to the \fB%h\fR substitution for binding scripts.
148
.TP
149
\fB\-keycode\fI number\fR
150
\fINumber\fR  must be an integer;  it specifies the \fIkeycode\fR
151
field for the event.
152
Valid for \fBKeyPress\fR and \fBKeyRelease\fR events.
153
Corresponds to the \fB%k\fR substitution for binding scripts.
154
.TP
155
\fB\-keysym\fI name\fR
156
\fIName\fR must be the name of a valid keysym, such as \fBg\fR,
157
\fBspace\fR, or \fBReturn\fR;  its corresponding
158
keycode value is used as the \fIkeycode\fR field for event, overriding
159
any detail specified in the base \fIevent\fR argument.
160
Valid for \fBKeyPress\fR and \fBKeyRelease\fR events.
161
Corresponds to the \fB%K\fR substitution for binding scripts.
162
.TP
163
\fB\-mode\fI notify\fR
164
\fINotify\fR specifies the \fImode\fR field for the event and must be
165
one of \fBNotifyNormal\fR, \fBNotifyGrab\fR, \fBNotifyUngrab\fR, or
166
\fBNotifyWhileGrabbed\fR.
167
Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR, and
168
\fBFocusOut\fR events.
169
Corresponds to the \fB%m\fR substitution for binding scripts.
170
.TP
171
\fB\-override\fI boolean\fR
172
\fIBoolean\fR must be a boolean value;  it specifies the
173
\fIoverride_redirect\fR field for the event.
174
Valid for \fBMap\fR, \fBReparent\fR, and \fBConfigure\fR events.
175
Corresponds to the \fB%o\fR substitution for binding scripts.
176
.TP
177
\fB\-place\fI where\fR
178
\fIWhere\fR specifies the \fIplace\fR field for the event;  it must be
179
either \fBPlaceOnTop\fR or \fBPlaceOnBottom\fR.
180
Valid for \fBCirculate\fR events.
181
Corresponds to the \fB%p\fR substitution for binding scripts.
182
.TP
183
\fB\-root\fI window\fR
184
\fIWindow\fR must be either a window path name or an integer window
185
identifier;  it specifies the \fIroot\fR field for the event.
186
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
187
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
188
events.
189
Corresponds to the \fB%R\fR substitution for binding scripts.
190
.TP
191
\fB\-rootx\fI coord\fR
192
\fICoord\fR must be a screen distance;  it specifies the \fIx_root\fR
193
field for the event.
194
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
195
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
196
events.  Corresponds to the \fB%X\fR substitution for binding scripts.
197
.TP
198
\fB\-rooty\fI coord\fR
199
\fICoord\fR must be a screen distance;  it specifies th \fIy_root\fR
200
field for the event.
201
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
202
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
203
events.
204
Corresponds to the \fB%Y\fR substitution for binding scripts.
205
.TP
206
\fB\-sendevent\fI boolean\fR
207
\fBBoolean\fR must be a boolean value;  it specifies the \fIsend_event\fR
208
field for the event.  Valid for all events.  Corresponds to the
209
\fB%E\fR substitution for binding scripts.
210
.TP
211
\fB\-serial\fI number\fR
212
\fINumber\fR must be an integer;  it specifies the \fIserial\fR field
213
for the event.  Valid for all events.
214
Corresponds to the \fB%#\fR substitution for binding scripts.
215
.TP
216
\fB\-state\fI state\fR
217
\fIState\fR specifies the \fIstate\fR field for the event.
218
For \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
219
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events
220
it must be an integer value.
221
For \fBVisibility\fR events it must be one of \fBVisibilityUnobscured\fR,
222
\fBVisibilityPartiallyObscured\fR, or \fBVisibilityFullyObscured\fR.
223
This option overrides any modifiers such as \fBMeta\fR or \fBControl\fR
224
specified in the base \fIevent\fR.
225
Corresponds to the \fB%s\fR substitution for binding scripts.
226
.TP
227
\fB\-subwindow\fI window\fR
228
\fIWindow\fR specifies the \fIsubwindow\fR field for the event, either
229
as a path name for a Tk widget or as an integer window identifier.
230
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
231
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events.
232
Similar to \fB%S\fR substitution for binding scripts.
233
.TP
234
\fB\-time\fI integer\fR
235
\fIInteger\fR must be an integer value;  it specifies the \fItime\fR field
236
for the event.
237
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
238
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR,
239
and \fBProperty\fR events.
240
Corresponds to the \fB%t\fR substitution for binding scripts.
241
.TP
242
\fB\-width\fI size\fR
243
\fISize\fR must be a screen distance;  it specifies the \fIwidth\fR field
244
for the event.
245
Valid for \fBConfigure\fR events.
246
Corresponds to the \fB%w\fR substitution for binding scripts.
247
.TP
248
\fB\-when\fI when\fR
249
\fIWhen\fR determines when the event will be processed;  it must have one
250
of the following values:
251
.RS
252
.IP \fBnow\fR 10
253
Process the event immediately, before the command returns.
254
This also happens if the \fB\-when\fR option is omitted.
255
.IP \fBtail\fR 10
256
Place the event on Tcl's event queue behind any events already
257
queued for this application.
258
.IP \fBhead\fR 10
259
Place the event at the front of Tcl's event queue, so that it
260
will be handled before any other events already queued.
261
.IP \fBmark\fR 10
262
Place the event at the front of Tcl's event queue but behind any
263
other events already queued with \fB\-when mark\fR.
264
This option is useful when generating a series of events that should
265
be processed in order but at the front of the queue.
266
.RE
267
.TP
268
\fB\-x\fI coord\fR
269
\fICoord\fR must be a screen distance;  it specifies the \fIx\fR field
270
for the event.
271
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
272
\fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR,
273
\fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR
274
events.
275
Corresponds to the the \fB%x\fR substitution for binding scripts.
276
.TP
277
\fB\-y\fI coord\fR
278
\fICoord\fR must be a screen distance;  it specifies the \fIy\fR
279
field for the event.
280
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
281
\fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR,
282
\fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR
283
events.
284
Corresponds to the the \fB%y\fR substitution for binding scripts.
285
.PP
286
Any options that are not specified when generating an event are filled
287
with the value 0, except for \fIserial\fR, which is filled with the
288
next X event serial number.
289
 
290
.SH "VIRTUAL EVENT EXAMPLES"
291
.PP
292
In order for a virtual event binding to trigger, two things must
293
happen.  First, the virtual event must be defined with the
294
\fBevent add\fR command.  Second, a binding must be created for
295
the virtual event with the \fBbind\fR command.
296
Consider the following virtual event definitions:
297
.CS
298
event add <> 
299
event add <> 
300
event add <> 
301
event add <> 
302
.CE
303
In the \fBbind\fR command, a virtual event can be bound like any other
304
builtin event type as follows:
305
.CS
306
bind Entry <> {%W insert [selection get]}
307
.CE
308
The double angle brackets are used to specify that a virtual event is being
309
bound.  If the user types Control-y or presses button 2, or if
310
a \fB<>\fR virtual event is synthesized with \fBevent generate\fR,
311
then the \fB<>\fR binding will be invoked.
312
.PP
313
If a virtual binding has the exact same sequence as a separate
314
physical binding, then the physical binding will take precedence.
315
Consider the following example:
316
.CS
317
event add <>  
318
bind Entry  {puts Control-y}
319
bind Entry <> {puts Paste}
320
.CE
321
When the user types Control-y the \fB\fR binding
322
will be invoked, because a physical event is considered
323
more specific than a virtual event, all other things being equal.
324
However, when the user types Meta-Control-y the
325
\fB<>\fR binding will be invoked, because the
326
\fBMeta\fR modifier in the physical pattern associated with the
327
virtual binding is more specific than the \fB sequence for
328
the physical event.
329
.PP
330
Bindings on a virtual event may be created before the virtual event exists.
331
Indeed, the virtual event never actually needs to be defined, for instance,
332
on platforms where the specific virtual event would meaningless or
333
ungeneratable.
334
.PP
335
When a definition of a virtual event changes at run time, all windows
336
will respond immediately to the new definition.
337
Starting from the preceding example, if the following code is executed:
338
.CS
339
bind   {}
340
event add <> 
341
.CE
342
the behavior will change such in two ways.  First, the shadowed
343
\fB<>\fR binding will emerge.
344
Typing Control-y will no longer invoke the \fB\fR binding,
345
but instead invoke the virtual event \fB<>\fR.  Second,
346
pressing the F6 key will now also invoke the \fB<>\fR binding.
347
 
348
.SH "SEE ALSO"
349
bind
350
 
351
.SH KEYWORDS
352
event, binding, define, handle, virtual event

powered by: WebSVN 2.1.0

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