It seems there is a bug of Tk 9.0b1.
In /tk9.0b1/library/demos/menu.tcl
, if you remove all "-underline ..."
options, any Alt+key leads to an error.
To reproduce it:
remove all
"-underline ..."
of/tk9.0b1/library/demos/menu.tcl
then run command:
tk9.0b1 /tk9.0b1/library/demos/widget
then choose
" Menus and cascades (sub-menus) "
press any Alt+key (say, Alt+S)
=> the error:
bad index "": must be integer?[+-]integer? or end?[+-]integer?
bad index "": must be integer?[+-]integer? or end?[+-]integer?
while executing
"string index [$child entrycget $i -label] [$child entrycget $i -underline]"
(procedure "MenuFind" line 19)
invoked from within
"MenuFind [winfo toplevel $w] $char"
(procedure "tk::TraverseToMenu" line 14)
invoked from within
"tk::TraverseToMenu .menu o"
(command bound to event)
The cause is just in the absence of "-underline..."
option of menubar items.
If the option is set as "-underline -1"
(attempting to have no underlined characters), the bug remains. However, the weird "-underline 999"
solves the problem so that you have no underlined menu characters and no bugs of Alt+key sort.
In Tk 8.6 there are no problems with this. Probably, in Tk 9.0, menu.tcl is to blame, with its " >=0 "
clauses.
The issue looks strange as the "-underline"
option looks mostly out-date, though useful in some cases.