Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Tk groups bindings into collections called “binding tags” (or bindtags for short). Each widget starts with four bindtags defined on it:</p> <ol> <li>the bindtag for the widget itself (with the same name as the widget),</li> <li>the bindtag for the widget's class,</li> <li>the bindtag for the toplevel containing the widget, and</li> <li>the “<code>all</code>” bindtag for global bindings.</li> </ol> <p>(Toplevels have just three bindtags.) The first argument to <code>bind</code> is not actually a widget name, but rather a bindtag name. You can get and manipulate the list of bindtags for a widget using the <code>bindtags</code> command, though that's a very far-reaching change to apply to a widget; you probably want to avoid changing the bindtags unless you're digging into the depths. (In effect you're changing the stack of controllers applied to a particular view; very subtle stuff to modify.)</p> <p>When processing a GUI event sent to a widget, the bindtags for that widget are considered in order, and exactly one entry in the binding table attached to that bindtag is found (or the table is skipped if there are no matches) and evaluated after substitutions are applied. Then the binding table for the next bindtag is evaluated, <strong><em>unless the binding script evaluation produces a <code>break</code> exception</em></strong>. If a binding evaluation wishes to prevent consideration of further scripts attached to binding tags further on the stack, it needs to finish with a <code>break</code>.</p> <p>Which all sounds rather complicated, but isn't. In the simplest case, put <code>break</code> on the end of a widget binding script to stop a later class, toplevel or global binding script from applying.</p> <pre><code>bind $::app &lt;Control_L&gt;&lt;o&gt; {FileOpen} bind $::app &lt;Control_L&gt;&lt;O&gt; {FileOpen} bind $::app.text &lt;Control_L&gt;&lt;o&gt; {SpecificOperation; break} bind $::app.text &lt;Control_L&gt;&lt;O&gt; {SpecificOperation; break} </code></pre> <p>OK, so <code>SpecificOperation</code> might be nothing at all. You'll have to tune however you want.</p> <hr> <p>You can also put the logic for doing the <code>break</code> into <code>SpecificOperation</code>, which is great when you need to only do the <code>break</code> sometimes, but to make a procedure issue a break to its caller you have to do it like this:</p> <pre><code>return -code break </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload