home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _40e653917b32cea387699eb651c44b1a < prev    next >
Text File  |  2000-03-23  |  6KB  |  134 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#bugs">BUGS</A></LI>
  26.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  27.     <LI><A HREF="#keywords">KEYWORDS</A></LI>
  28. </UL>
  29. <!-- INDEX END -->
  30.  
  31. <HR>
  32. <P>
  33. <H1><A NAME="name">NAME</A></H1>
  34. <P>Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</P>
  35. <P>
  36. <HR>
  37. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  38. <UL>
  39. <LI>Linux</LI>
  40. <LI>Solaris</LI>
  41. <LI>Windows</LI>
  42. </UL>
  43. <HR>
  44. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  45. <P><EM>$widget</EM>-><STRONG>bindtags</STRONG>([<EM>tagList</EM>]);
  46. <EM>@tags</EM> = <EM>$widget</EM>-><STRONG>bindtags</STRONG>;</P>
  47. <P>
  48. <HR>
  49. <H1><A NAME="description">DESCRIPTION</A></H1>
  50. <P>When a binding is created with the <STRONG>bind</STRONG> command, it is
  51. associated either with a particular window such as <EM>$widget</EM>,
  52. a class name such as <STRONG>Tk::Button</STRONG>, the keyword <STRONG>all</STRONG>, or any
  53. other string.
  54. All of these forms are called <EM>binding tags</EM>.
  55. Each window has a list of binding tags that determine how
  56. events are processed for the window.
  57. When an event occurs in a window, it is applied to each of the
  58. window's tags in order:  for each tag, the most specific binding
  59. that matches the given tag and event is executed.
  60. See the <A HREF="../../../site/lib/Tk/bind.html">the Tk::bind manpage</A> documentation for more information on the matching
  61. process.</P>
  62. <P>By default, each window has four binding tags consisting of the
  63. the window's class name, name of the window, the name of the window's
  64. nearest toplevel ancestor, and <STRONG>all</STRONG>, in that order.
  65. Toplevel windows have only three tags by default, since the toplevel
  66. name is the same as that of the window.</P>
  67. <P>Note that this order is <EM>different</EM> from order used by Tcl/Tk.
  68. Tcl/Tk has the window ahead of the class name in the binding order.
  69. This is because Tcl is procedural rather than object oriented and
  70. the normal way for Tcl/Tk applications to override class bindings
  71. is with an instance binding. However, with perl/Tk the normal way
  72. to override a class binding is to derive a class. The perl/Tk order
  73. causes instance bindings to execute after the class binding, and
  74. so instance bind callbacks can make use of state changes (e.g. changes
  75. to the selection) than the class bindings have made.</P>
  76. <P>The <STRONG>bindtags</STRONG> command allows the binding tags for a window to be
  77. read and modified.</P>
  78. <P>If <EM>$widget</EM>-><STRONG>bindtags</STRONG> is invoked without an argument, then the
  79. current set of binding tags for $widget is returned as a list.
  80. If the <EM>tagList</EM> argument is specified to <STRONG>bindtags</STRONG>,
  81. then it must be a reference to and array; the tags for $widget are changed
  82. to the elements of the array. (A reference to an anonymous array can
  83. be created by enclosin the elements in <STRONG>[ ]</STRONG>.)
  84. The elements of <EM>tagList</EM> may be arbitrary strings or widget objects,
  85. if no window exists for an object at the time an event is processed,
  86. then the tag is ignored for that event.
  87. The order of the elements in <EM>tagList</EM> determines the order in
  88. which binding callbacks are executed in response to events.
  89. For example, the command</P>
  90. <PRE>
  91.  $b->bindtags([$b,ref($b),$b->toplevel,'all'])</PRE>
  92. <P>applies the Tcl/Tk binding order which binding callbacks will be
  93. evaluated for a button (say) <STRONG>$b</STRONG> so that <STRONG>$b</STRONG>'s instance bindings
  94. are invoked first, following by bindings for <STRONG>$b</STRONG>'s class, followed by
  95. bindings for <STRONG>$b</STRONG>'s toplevel, followed by '<STRONG>all</STRONG>' bindings.</P>
  96. <P>If <EM>tagList</EM> is an empty list i.e. <STRONG>[]</STRONG>, then the binding
  97. tags for $widget are returned to the perl/Tk default state described above.</P>
  98. <P>The <STRONG>bindtags</STRONG> command may be used to introduce arbitrary
  99. additional binding tags for a window, or to remove standard tags.
  100. For example, the command</P>
  101. <PRE>
  102.  $b->bindtags(['TrickyButton',$b->toplevel,'all'])</PRE>
  103. <P>replaces the (say) <STRONG>Tk::Button</STRONG> tag for <STRONG>$b</STRONG> with <STRONG>TrickyButton</STRONG>.
  104. This means that the default widget bindings for buttons, which are
  105. associated with the <STRONG>Tk::Button</STRONG> tag, will no longer apply to <STRONG>$b</STRONG>,
  106. but any bindings associated with <STRONG>TrickyButton</STRONG> (perhaps some
  107. new button behavior) will apply.</P>
  108. <P>
  109. <HR>
  110. <H1><A NAME="bugs">BUGS</A></H1>
  111. <P>The current mapping of the 'native' Tk behaviour of this method
  112. i.e. returning a list but only accepting a reference to an array is
  113. counter intuitive. The perl/Tk interface  may be tidied up, returning
  114. a list is sensible so, most likely fix will be to allow a list to be
  115. passed to /fIset/fR the bindtags.</P>
  116. <P>
  117. <HR>
  118. <H1><A NAME="see also">SEE ALSO</A></H1>
  119. <P><A HREF="../../../site/lib/Tk/bind.html">Tk::bind</A>
  120. <A HREF="../../../site/lib/Tk/callbacks.html">Tk::callbacks</A></P>
  121. <P>
  122. <HR>
  123. <H1><A NAME="keywords">KEYWORDS</A></H1>
  124. <P>binding, event, tag</P>
  125. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  126. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  127. <STRONG><P CLASS=block> Tk::bindtags - Determine which bindings apply to a window, and order of evaluation</P></STRONG>
  128. </TD></TR>
  129. </TABLE>
  130.  
  131. </BODY>
  132.  
  133. </HTML>
  134.