Tk Source Code

View Ticket
Login
Ticket UUID: 220285
Title: Tab key does not trigger "bind all <Key>" scripts
Type: Bug Version: obsolete: 8.3
Submitter: welch Created on: 2000-10-31 23:01:43
Subsystem: 65. Generic Window Operations Assigned To: nobody
Priority: 1 Zero Severity:
Status: Closed Last Modified: 2001-04-26 06:10:33
Resolution: Invalid Closed By: dgp
    Closed on: 2001-04-25 23:10:33
Description:
OriginalBugID: 4347 Bug
Version: 8.3
SubmitDate: '2000-03-08'
LastModified: '2000-03-10'
Severity: MED
Status: Closed
Submitter: techsupp
ChangedBy: ericm
OS: Linux-Red Hat
OSVersion: Red Hat 6.1
Machine: AMD K6 233 MHz
ClosedDate: '2000-03-10'


Name:
Jeremy Henty

Extensions:
N/A

CustomShell:
None

ReproducibleScript:
Run wish from the command line.  Type "bind all <Key> { bell; } at the prompt.
Move the focus to the wish window and start pressing keys, including Tab.

ObservedBehavior:
All keys *except* Tab cause the Tk bell to ring when typed into the wish window.
NB: using "bind ." instead of "bind all" does not suffer from this problem.

DesiredBehavior:
The Tab key should ring the bell, just as the other keys do.



From the "bind" manual entry:

       If  more  than  one binding matches a particular event and
       they have the same tag, then the most specific binding  is
       chosen  and  its script is evaluated.  The following tests
       are applied, in  order,  to  determine  which  of  several
       matching  sequences is more specific: (a) an event pattern
       that specifies a specific button or key is  more  specific
       than  one that doesn't; (b) a longer sequence (in terms of
       number of events matched) is more specific than a  shorter
       sequence;  (c)  if  the modifiers specified in one pattern
       are a subset of the modifiers in another pattern, then the
       pattern  with more modifiers is more specific.  (d) a vir-
       tual event whose physical pattern matches the sequence  is
       less  specific  than the same physical pattern that is not
       associated with a virtual event.   (e)  given  a  sequence
       that  matches  two  or  more  virtual  events,  one of the
       virtual events will be chosen, but the order is undefined.

By default, Tk has the following binding set up:

bind all <Tab> {tkTabToWindow [tk_focusNext %W]}

This makes tab work for keyboard focus traversals.  When combined with a
binding like

bind all <Key> {bell;}

the combination of the two falls under case (a) above:  the more specific
binding <Tab> is evaluated and the <Key> binding is ignored.

- eric

 
-- 03/10/2000 ericm