Tk Source Code

View Ticket
Login
Ticket UUID: 1457279
Title: w32: Creating Alt-Key binding on all breaks default handling
Type: Bug Version: obsolete: 8.4.12
Submitter: jepler Created on: 2006-03-23 21:02:38
Subsystem: 01. Bindings Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-10 19:01:54
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-10 19:01:54
Description:
If a binding for <Alt-Key> is created or added on the
'all' tag, normal handling of special keystrokes (e.g.,
Alt-F4) no longer works.

How to reproduce:
1. Invoke wish84.exe
2. execute one of the following commands:
     bind all <Alt-Key> [bind all <Alt-Key>];
     bind all <Alt-Key> {+puts example};
     bind all <Alt-Key> {puts example};
(any command that modifies the binding of <Alt-Key> on
the 'all' tag, even ones that should leave any existing
binding still in effect)
3. Focus the main window and press Alt-F4.

Expected behavior: The window closes
Actual behavior: the window does not close.

This problem exists in ActiveState ActiveTcl 8.4.12.0
as well as a self-compiled version of tk 8.4.10. 
Tested on a Windows XP SP2 machine.

The problem apparently arises because bindings created
by TkCreateBindingProcedure do not behave like normal
bindings, acting instead like empty bindings when
queried or modified by the [bind] command.
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-10 19:01:54:

Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [1d86dae4], [692f0347], and [a3e63a06].


serhiy.storchaka added on 2026-09-19 09:51:06:

Since Tk 8.5 these are ordinary script bindings (bind all <Alt-Key> returns tk::WinMenuKey %W %N), so re-setting or extending them with + keeps Alt-F4 working; replacing them disables the forwarding of the key to Windows. Branch [2c1f1cbebd] documents this in the bind manual.