Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / Tk::event.3
.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "EVENT 1"
.TH EVENT 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation"
.SH "NAME"
Tk::event \- Miscellaneous event facilities: define virtual events and generate events
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fI$widget\fR\->\fBevent\fR\fIAction\fR(?\fIarg, arg, ...\fR?);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBevent\fR\fIAction\fR methods provides several facilities for dealing with
window system events, such as defining virtual events and synthesizing
events. Virtual events are shared by all widgets of the same
\&\fBMainWindow\fR. Different MainWindows can have different
virtual event.
.PP
The following methods are currently supported:
.IP "\fI$widget\fR\->\fBeventAdd\fR(\fB'<<\fR\fIvirtual\fR\fB>>'\fR\fI, sequence \fR?,\fIsequence, ...\fR?)" 4
.IX Item "$widget->eventAdd('<<virtual>>', sequence ?,sequence, ...?)"
Associates the virtual event \fIvirtual\fR with the physical
event sequence(s) given by the \fIsequence\fR arguments, so that
the virtual event will trigger whenever any one of the \fIsequence\fRs
occurs.
\&\fIVirtual\fR may be any string value and \fIsequence\fR may have
any of the values allowed for the \fIsequence\fR argument to the
bind method.
If \fIvirtual\fR is already defined, the new physical event sequences
add to the existing sequences for the event.
.IP "\fI$widget\fR\->\fBeventDelete\fR(\fB'<<\fR\fIvirtual\fR\fB>>'\fR ?,\fIsequence,\fR \fIsequence, ...\fR?)" 4
.IX Item "$widget->eventDelete('<<virtual>>' ?,sequence, sequence, ...?)"
Deletes each of the \fIsequence\fRs from those associated with
the virtual event given by \fIvirtual\fR.
\&\fIVirtual\fR may be any string value and \fIsequence\fR may have
any of the values allowed for the \fIsequence\fR argument to the
bind method.
Any \fIsequence\fRs not currently associated with \fIvirtual\fR
are ignored.
If no \fIsequence\fR argument is provided, all physical event sequences
are removed for \fIvirtual\fR, so that the virtual event will not
trigger anymore.
.IP "\fI$widget\fR\->\fBeventGenerate\fR(\fIevent\fR ?,\fIoption => value, option => value, ...\fR?)" 4
.IX Item "$widget->eventGenerate(event ?,option => value, option => value, ...?)"
Generates a window event and arranges for it to be processed just as if
it had come from the window system.
\&\fI$window\fR is a reference to the window for which the event
will be generated.
\&\fIEvent\fR provides a basic description of
the event, such as \fB<Shift\-Button\-2>\fR or \fB<<Paste>>\fR.
If \fIWindow\fR is empty the whole screen is meant, and coordinates
are relative to the screen.
\&\fIEvent\fR may have any of the forms allowed for the \fIsequence\fR
argument of the bind method except that it must consist
of a single event pattern, not a sequence.
\&\fIOption-value\fR pairs may be used to specify additional
attributes of the event, such as the x and y mouse position;
see \*(L"\s-1EVENT\s0 \s-1FIELDS\s0\*(R" below. If the \fB\-when\fR option is not specified, the
event is processed immediately: all of the handlers for the event
will complete before the \fBeventGenerate\fR method returns.
If the \fB\-when\fR option is specified then it determines when the
event is processed.
.IP "\fI$widget\fR\->\fBeventInfo\fR(?'\fB<<\fR\fIvirtual\fR\fB>>'\fR?)" 4
.IX Item "$widget->eventInfo(?'<<virtual>>'?)"
Returns information about virtual events.
If the \fB<<\fR\fIvirtual\fR\fB>>\fR argument is omitted, the return value
is a list of all the virtual events that are currently defined.
If \fB<<\fR\fIvirtual\fR\fB>>\fR is specified then the return value is
a list whose elements are the physical event sequences currently
defined for the given virtual event; if the virtual event is
not defined then \fBundef\fR is returned.
.SH "EVENT FIELDS"
.IX Header "EVENT FIELDS"
The following options are supported for the \fBeventGenerate\fR
method. These correspond to the ``%'' expansions
allowed in binding callback for the bind method.
.IP "\fB\-above\fR => \fIwindow\fR" 4
.IX Item "-above => window"
\&\fIWindow\fR specifies the \fIabove\fR field for the event,
either as a window path name or as an integer window id.
Valid for \fBConfigure\fR events.
Corresponds to the %a substitution for binding scripts.
.IP "\fB\-borderwidth\fR => \fIsize\fR" 4
.IX Item "-borderwidth => size"
\&\fISize\fR must be a screen distance; it specifies the
\&\fIborder_width\fR field for the event.
Valid for \fBConfigure\fR events.
Corresponds to the %B substitution for binding scripts.
.IP "\fB\-button\fR => \fInumber\fR" 4
.IX Item "-button => number"
\&\fINumber\fR must be an integer; it specifies the \fIdetail\fR field
for a \fBButtonPress\fR or \fBButtonRelease\fR event, overriding
any button number provided in the base \fIevent\fR argument.
Corresponds to the %b substitution for binding scripts.
.IP "\fB\-count\fR => \fInumber\fR" 4
.IX Item "-count => number"
\&\fINumber\fR must be an integer; it specifies the \fIcount\fR field
for the event. Valid for \fBExpose\fR events.
Corresponds to the %c substitution for binding scripts.
.IP "\fB\-detail\fR => \fIdetail\fR" 4
.IX Item "-detail => detail"
\&\fIDetail\fR specifies the \fIdetail\fR field for the event
and must be one of the following:
.RS 4
.Sp
.Vb 4
\& NotifyAncestor NotifyNonlinearVirtual
\& NotifyDetailNone NotifyPointer
\& NotifyInferior NotifyPointerRoot
\& NotifyNonlinear NotifyVirtual
.Ve
.Sp
.RS 8
Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR and
\&\fBFocusOut\fR events.
Corresponds to the %d substitution for binding scripts.
.RE
.RE
.RS 4
.RE
.IP "\fB\-focus\fR\fI boolean\fR" 4
.IX Item "-focus boolean"
\&\fIBoolean\fR must be a boolean value; it specifies the \fIfocus\fR
field for the event.
Valid for \fBEnter\fR and \fBLeave\fR events.
Corresponds to the %f substitution for binding scripts.
.IP "\fB\-height\fR\fI size\fR" 4
.IX Item "-height size"
\&\fISize\fR must be a screen distance; it specifies the \fIheight\fR
field for the event. Valid for \fBConfigure\fR events.
Corresponds to the %h substitution for binding scripts.
.IP "\fB\-keycode\fR\fI number\fR" 4
.IX Item "-keycode number"
\&\fINumber\fR must be an integer; it specifies the \fIkeycode\fR
field for the event.
Valid for \fBKeyPress\fR and \fBKeyRelease\fR events.
Corresponds to the %k substitution for binding scripts.
.IP "\fB\-keysym\fR\fI name\fR" 4
.IX Item "-keysym name"
\&\fIName\fR must be the name of a valid keysym, such as \fBg\fR,
\&\fBspace\fR, or \fBReturn\fR; its corresponding
keycode value is used as the \fIkeycode\fR field for event, overriding
any detail specified in the base \fIevent\fR argument.
Valid for \fBKeyPress\fR and \fBKeyRelease\fR events.
Corresponds to the %K substitution for binding scripts.
.IP "\fB\-mode\fR\fI notify\fR" 4
.IX Item "-mode notify"
\&\fINotify\fR specifies the \fImode\fR field for the event and must be
one of \fBNotifyNormal\fR, \fBNotifyGrab\fR, \fBNotifyUngrab\fR, or
\&\fBNotifyWhileGrabbed\fR.
Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR, and
\&\fBFocusOut\fR events.
Corresponds to the %m substitution for binding scripts.
.IP "\fB\-override\fR\fI boolean\fR" 4
.IX Item "-override boolean"
\&\fIBoolean\fR must be a boolean value; it specifies the
\&\fIoverride_redirect\fR field for the event.
Valid for \fBMap\fR, \fBReparent\fR, and \fBConfigure\fR events.
Corresponds to the %o substitution for binding scripts.
.IP "\fB\-place\fR\fI where\fR" 4
.IX Item "-place where"
\&\fIWhere\fR specifies the \fIplace\fR field for the event; it must be
either \fBPlaceOnTop\fR or \fBPlaceOnBottom\fR.
Valid for \fBCirculate\fR events.
Corresponds to the %p substitution for binding scripts.
.IP "\fB\-root\fR\fI window\fR" 4
.IX Item "-root window"
\&\fIWindow\fR must be either a window path name or an integer window
identifier; it specifies the \fIroot\fR field for the event.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
events.
Corresponds to the %R substitution for binding scripts.
.IP "\fB\-rootx\fR\fI coord\fR" 4
.IX Item "-rootx coord"
\&\fICoord\fR must be a screen distance; it specifies the \fIx_root\fR
field for the event.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
events. Corresponds to the %X substitution for binding scripts.
.IP "\fB\-rooty\fR\fI coord\fR" 4
.IX Item "-rooty coord"
\&\fICoord\fR must be a screen distance; it specifies the \fIy_root\fR
field for the event.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR
events.
Corresponds to the %Y substitution for binding scripts.
.IP "\fB\-sendevent\fR\fI boolean\fR" 4
.IX Item "-sendevent boolean"
\&\fBBoolean\fR must be a boolean value; it specifies the \fIsend_event\fR
field for the event. Valid for all events. Corresponds to the
%E substitution for binding scripts.
.IP "\fB\-serial\fR\fI number\fR" 4
.IX Item "-serial number"
\&\fINumber\fR must be an integer; it specifies the \fIserial\fR field
for the event. Valid for all events.
Corresponds to the %# substitution for binding scripts.
.IP "\fB\-state\fR\fI state\fR" 4
.IX Item "-state state"
\&\fIState\fR specifies the \fIstate\fR field for the event.
For \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events
it must be an integer value.
For \fBVisibility\fR events it must be one of \fBVisibilityUnobscured\fR,
\&\fBVisibilityPartiallyObscured\fR, or \fBVisibilityFullyObscured\fR.
This option overrides any modifiers such as \fBMeta\fR or \fBControl\fR
specified in the base \fIevent\fR.
Corresponds to the %s substitution for binding scripts.
.IP "\fB\-subwindow\fR\fI window\fR" 4
.IX Item "-subwindow window"
\&\fIWindow\fR specifies the \fIsubwindow\fR field for the event, either
as a path name for a Tk widget or as an integer window identifier.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events.
Similar to %S substitution for binding scripts.
.IP "\fB\-time\fR\fI integer\fR" 4
.IX Item "-time integer"
\&\fIInteger\fR must be an integer value; it specifies the \fItime\fR field
for the event.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR,
and \fBProperty\fR events.
Corresponds to the %t substitution for binding scripts.
.IP "\fB\-warp\fR\fI boolean\fR" 4
.IX Item "-warp boolean"
\&\fIboolean\fR must be a boolean value; it specifies whether
the screen pointer should be warped as well.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, and \fBMotion\fR events.
.IP "\fB\-width\fR\fI size\fR" 4
.IX Item "-width size"
\&\fISize\fR must be a screen distance; it specifies the \fIwidth\fR field
for the event.
Valid for \fBConfigure\fR events.
Corresponds to the %w substitution for binding scripts.
.IP "\fB\-when\fR\fI when\fR" 4
.IX Item "-when when"
\&\fIWhen\fR determines when the event will be processed; it must have one
of the following values:
.RS 4
.IP "\fBnow\fR" 8
.IX Item "now"
Process the event immediately, before the command returns.
This also happens if the \fB\-when\fR option is omitted.
.IP "\fBtail\fR" 8
.IX Item "tail"
Place the event on perl/Tk's event queue behind any events already
queued for this application.
.IP "\fBhead\fR" 8
.IX Item "head"
Place the event at the front of perl/Tk's event queue, so that it
will be handled before any other events already queued.
.IP "\fBmark\fR" 8
.IX Item "mark"
Place the event at the front of perl/Tk's event queue but behind any
other events already queued with \fB\-when mark\fR.
This option is useful when generating a series of events that should
be processed in order but at the front of the queue.
.RE
.RS 4
.RE
.IP "\fB\-x\fR\fI coord\fR" 4
.IX Item "-x coord"
\&\fICoord\fR must be a screen distance; it specifies the \fIx\fR field
for the event.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR,
\&\fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR
events.
Corresponds to the the %x substitution for binding scripts.
If \fIWindow\fR is empty the coordinate is relative to the
screen, and this option corresponds to the %X substitution
for binding scripts.
.IP "\fB\-y\fR\fI coord\fR" 4
.IX Item "-y coord"
\&\fICoord\fR must be a screen distance; it specifies the \fIy\fR
field for the event.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\&\fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR,
\&\fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR
events.
Corresponds to the the %y substitution for binding scripts.
If \fIWindow\fR is empty the coordinate is relative to the
screen, and this option corresponds to the %Y substitution
for binding scripts.
.Sp
Any options that are not specified when generating an event are filled
with the value 0, except for \fIserial\fR, which is filled with the
next X event serial number.
.SH "VIRTUAL EVENT EXAMPLES"
.IX Header "VIRTUAL EVENT EXAMPLES"
In order for a virtual event binding to trigger, two things must
happen. First, the virtual event must be defined with the
\&\fBeventAdd\fR method. Second, a binding must be created for
the virtual event with the \fBbind\fR method.
Consider the following virtual event definitions:
.PP
.Vb 4
\& $widget->eventAdd('<<Paste>>' => '<Control-y>');
\& $widget->eventAdd('<<Paste>>' => '<Button-2>');
\& $widget->eventAdd('<<Save>>' => '<Control-X><Control-S>');
\& $widget->eventAdd('<<Save>>' => '<Shift-F12>');
.Ve
.PP
In the \fBbind\fR method, a virtual event can be bound like any other
builtin event type as follows:
.PP
.Vb 2
\& $entry->bind('Tk::Entry', '<<Paste>>' => sub {
\& $entry->Insert($entry->selectionGet) });
.Ve
.PP
The double angle brackets are used to specify that a virtual event is being
bound. If the user types Control-y or presses button 2, or if
a \fB<<Paste>>\fR virtual event is synthesized with \fBeventGenerate\fR,
then the \fB<<Paste>>\fR binding will be invoked.
.PP
If a virtual binding has the exact same sequence as a separate
physical binding, then the physical binding will take precedence.
Consider the following example:
.PP
.Vb 3
\& $mw->eventAdd('<<Paste>>' => '<Control-y>','<Meta-Control-y>');
\& $mw->bind('Tk::Entry', '<Control-y>' => sub{print 'Control-y'});
\& $mw->bind('Tk::Entry', '<<Paste>>' => sub{print 'Paste'});
.Ve
.PP
When the user types Control-y the \fB<Control-y>\fR binding
will be invoked, because a physical event is considered
more specific than a virtual event, all other things being equal.
However, when the user types Meta-Control-y the
\&\fB<<Paste>>\fR binding will be invoked, because the
\&\fBMeta\fR modifier in the physical pattern associated with the
virtual binding is more specific than the \fB<Control-y\fR> sequence for
the physical event.
.PP
Bindings on a virtual event may be created before the virtual event exists.
Indeed, the virtual event never actually needs to be defined, for instance,
on platforms where the specific virtual event would meaningless or
ungeneratable.
.PP
When a definition of a virtual event changes at run time, all windows
will respond immediately to the new definition.
Starting from the preceding example, if the following code is executed:
.PP
.Vb 2
\& $entry->bind(ref($entry), '<Control-y>' => undef);
\& $entry->eventAdd('<<Paste>>' => '<Key-F6>');
.Ve
.PP
the behavior will change such in two ways. First, the shadowed
\&\fB<<Paste>>\fR binding will emerge.
Typing Control-y will no longer invoke the \fB<Control-y>\fR binding,
but instead invoke the virtual event \fB<<Paste>>\fR. Second,
pressing the F6 key will now also invoke the \fB<<Paste>>\fR binding.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Tk::bind
Tk::callbacks
.SH "KEYWORDS"
.IX Header "KEYWORDS"
event, binding, define, handle, virtual event