home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#bugs">BUGS</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P><EM>$widget</EM>-><STRONG>bindtags</STRONG>([<EM>tagList</EM>]);
- <EM>@tags</EM> = <EM>$widget</EM>-><STRONG>bindtags</STRONG>;</P>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>When a binding is created with the <STRONG>bind</STRONG> command, it is
- associated either with a particular window such as <EM>$widget</EM>,
- a class name such as <STRONG>Tk::Button</STRONG>, the keyword <STRONG>all</STRONG>, or any
- other string.
- All of these forms are called <EM>binding tags</EM>.
- Each window has 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 <A HREF="../../../site/lib/Tk/bind.html">the Tk::bind manpage</A> documentation for more information on the matching
- process.</P>
- <P>By default, each window has four binding tags consisting of the
- the window's class name, name of the window, the name of the window's
- nearest toplevel ancestor, and <STRONG>all</STRONG>, in that order.
- Toplevel windows have only three tags by default, since the toplevel
- name is the same as that of the window.</P>
- <P>Note that this order is <EM>different</EM> from order used by Tcl/Tk.
- Tcl/Tk has the window ahead of the class name in the binding order.
- This is because Tcl is procedural rather than object oriented and
- the normal way for Tcl/Tk applications to override class bindings
- is with an instance binding. However, with perl/Tk the normal way
- to override a class binding is to derive a class. The perl/Tk order
- causes instance bindings to execute after the class binding, and
- so instance bind callbacks can make use of state changes (e.g. changes
- to the selection) than the class bindings have made.</P>
- <P>The <STRONG>bindtags</STRONG> command allows the binding tags for a window to be
- read and modified.</P>
- <P>If <EM>$widget</EM>-><STRONG>bindtags</STRONG> is invoked without an argument, then the
- current set of binding tags for $widget is returned as a list.
- If the <EM>tagList</EM> argument is specified to <STRONG>bindtags</STRONG>,
- then it must be a reference to and array; the tags for $widget are changed
- to the elements of the array. (A reference to an anonymous array can
- be created by enclosin the elements in <STRONG>[ ]</STRONG>.)
- The elements of <EM>tagList</EM> may be arbitrary strings or widget objects,
- if no window exists for an object at the time an event is processed,
- then the tag is ignored for that event.
- The order of the elements in <EM>tagList</EM> determines the order in
- which binding callbacks are executed in response to events.
- For example, the command</P>
- <PRE>
- $b->bindtags([$b,ref($b),$b->toplevel,'all'])</PRE>
- <P>applies the Tcl/Tk binding order which binding callbacks will be
- evaluated for a button (say) <STRONG>$b</STRONG> so that <STRONG>$b</STRONG>'s instance bindings
- are invoked first, following by bindings for <STRONG>$b</STRONG>'s class, followed by
- bindings for <STRONG>$b</STRONG>'s toplevel, followed by '<STRONG>all</STRONG>' bindings.</P>
- <P>If <EM>tagList</EM> is an empty list i.e. <STRONG>[]</STRONG>, then the binding
- tags for $widget are returned to the perl/Tk default state described above.</P>
- <P>The <STRONG>bindtags</STRONG> command may be used to introduce arbitrary
- additional binding tags for a window, or to remove standard tags.
- For example, the command</P>
- <PRE>
- $b->bindtags(['TrickyButton',$b->toplevel,'all'])</PRE>
- <P>replaces the (say) <STRONG>Tk::Button</STRONG> tag for <STRONG>$b</STRONG> with <STRONG>TrickyButton</STRONG>.
- This means that the default widget bindings for buttons, which are
- associated with the <STRONG>Tk::Button</STRONG> tag, will no longer apply to <STRONG>$b</STRONG>,
- but any bindings associated with <STRONG>TrickyButton</STRONG> (perhaps some
- new button behavior) will apply.</P>
- <P>
- <HR>
- <H1><A NAME="bugs">BUGS</A></H1>
- <P>The current mapping of the 'native' Tk behaviour of this method
- i.e. returning a list but only accepting a reference to an array is
- counter intuitive. The perl/Tk interface may be tidied up, returning
- a list is sensible so, most likely fix will be to allow a list to be
- passed to /fIset/fR the bindtags.</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><A HREF="../../../site/lib/Tk/bind.html">Tk::bind</A>
- <A HREF="../../../site/lib/Tk/callbacks.html">Tk::callbacks</A></P>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>binding, event, tag</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-