Tk Source Code

View Ticket
Login
Ticket UUID: a30d3e493ba722255487b46e21785780dd58daf6
Title: Pressing Alt-<key> triggers an error popup.
Type: Bug Version: 9.0.2
Submitter: SVIDevelopment Created on: 2025-07-09 14:26:45
Subsystem: 12. Unix Menus Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2025-07-09 20:35:20
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2025-07-09 20:35:20
Description:
When starting the following simple script with wish:

wm geometry . 400x400
set menuButton [menubutton .menubutton]
grid $menuButton

And then pressing <Alt-x> or Alt in combination with some other key, I get the following error pop-up:

bad index "": must be integer?[+-]integer? or end?[+-]integer?
bad index "": must be integer?[+-]integer? or end?[+-]integer?
    while executing
"string index [$child cget -text]  [$child cget -underline]"
    (procedure "MenuFind" line 36)
    invoked from within
"MenuFind [winfo toplevel $w] $char"
User Comments: jan.nijtmans added on 2025-07-09 20:35:20:

One way to fix this would be TIP #615, but that TIP is not far enough (both TIP text and implementation) to be voted upon.

So, the binding script will need to be adapted. Done [8df4a22cdb0c08a7|here]


oehhar added on 2025-07-09 14:44:53:
Great finding. This is a side effect, that the default of "-underline" is now the empty string. This was not corrected in the corresponding binding script.

Thanks,
Harald