67 lines
3.6 KiB
HTML
67 lines
3.6 KiB
HTML
![]() |
<HTML><HEAD><TITLE>Tk Built-In Commands - bindtags manual page</TITLE></HEAD><BODY>
|
||
|
<H3><A NAME="M2">NAME</A></H3>
|
||
|
bindtags - Determine which bindings apply to a window, and order of evaluation
|
||
|
<H3><A NAME="M3">SYNOPSIS</A></H3>
|
||
|
<B>bindtags </B><I>window </I>?<I>tagList</I>?<BR>
|
||
|
<H3><A NAME="M4">DESCRIPTION</A></H3>
|
||
|
When a binding is created with the <B><A HREF="../TclCmd/bind.htm">bind</A></B> command, it is
|
||
|
associated either with a particular window such as <B>.a.b.c</B>,
|
||
|
a class name such as <B><A HREF="../TclCmd/button.htm">Button</A></B>, the keyword <B>all</B>, or any
|
||
|
other string.
|
||
|
All of these forms are called <I>binding tags</I>.
|
||
|
Each window contains a list of binding tags that determine how
|
||
|
events are processed for the window.
|
||
|
When an event occurs in a window, it is applied to each of the
|
||
|
window's tags in order: for each tag, the most specific binding
|
||
|
that matches the given tag and event is executed.
|
||
|
See the <B><A HREF="../TclCmd/bind.htm">bind</A></B> command for more information on the matching
|
||
|
process.
|
||
|
<P>
|
||
|
By default, each window has four binding tags consisting of the
|
||
|
name of the window, the window's class name, the name of the window's
|
||
|
nearest toplevel ancestor, and <B>all</B>, in that order.
|
||
|
Toplevel windows have only three tags by default, since the toplevel
|
||
|
name is the same as that of the window.
|
||
|
The <B>bindtags</B> command allows the binding tags for a window to be
|
||
|
read and modified.
|
||
|
<P>
|
||
|
If <B>bindtags</B> is invoked with only one argument, then the
|
||
|
current set of binding tags for <I>window</I> is returned as a list.
|
||
|
If the <I>tagList</I> argument is specified to <B>bindtags</B>,
|
||
|
then it must be a proper list; the tags for <I>window</I> are changed
|
||
|
to the elements of the list.
|
||
|
The elements of <I>tagList</I> may be arbitrary strings; however,
|
||
|
any tag starting with a dot is treated as the name of a window; if
|
||
|
no window by that name exists at the time an event is processed,
|
||
|
then the tag is ignored for that event.
|
||
|
The order of the elements in <I>tagList</I> determines the order in
|
||
|
which binding scripts are executed in response to events.
|
||
|
For example, the command
|
||
|
<PRE><B>bindtags .b {all . Button .b}</B></PRE>
|
||
|
reverses the order in which binding scripts will be evaluated for
|
||
|
a button named <B>.b</B> so that <B>all</B> bindings are invoked
|
||
|
first, following by bindings for <B>.b</B>'s toplevel (``.''), followed by
|
||
|
class bindings, followed by bindings for <B>.b</B>.
|
||
|
If <I>tagList</I> is an empty list then the binding tags for <I>window</I>
|
||
|
are returned to the default state described above.
|
||
|
<P>
|
||
|
The <B>bindtags</B> command may be used to introduce arbitrary
|
||
|
additional binding tags for a window, or to remove standard tags.
|
||
|
For example, the command
|
||
|
<PRE><B>bindtags .b {.b TrickyButton . all}</B></PRE>
|
||
|
replaces the <B><A HREF="../TclCmd/button.htm">Button</A></B> tag for <B>.b</B> with <B>TrickyButton</B>.
|
||
|
This means that the default widget bindings for buttons, which are
|
||
|
associated with the <B><A HREF="../TclCmd/button.htm">Button</A></B> tag, will no longer apply to <B>.b</B>,
|
||
|
but any bindings associated with <B>TrickyButton</B> (perhaps some
|
||
|
new button behavior) will apply.
|
||
|
|
||
|
<H3><A NAME="M5">SEE ALSO</A></H3>
|
||
|
<B><A HREF="../TclCmd/bind.htm">bind</A></B>
|
||
|
<H3><A NAME="M6">KEYWORDS</A></H3>
|
||
|
<A href="../Keywords/B.htm#binding">binding</A>, <A href="../Keywords/E.htm#event">event</A>, <A href="../Keywords/T.htm#tag">tag</A>
|
||
|
<HR><PRE>
|
||
|
<A HREF="../copyright.htm">Copyright</A> © 1990 The Regents of the University of California.
|
||
|
<A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc.
|
||
|
<A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE>
|
||
|
</BODY></HTML>
|