Version 6 of How to get Menu Accelerators to work under Windows

Updated 2004-01-07 22:00:54

PWQ 7 Jan 03 I have an application that was developed under linux.

When I tested it out under Windows I found to my dismay that Alt-Key did not post the menus as it does under Linux.

What is the magic incantation to make it happen without binding each and every key?

RS I notice with my Tk app on Windows 2000, that Alt-F highlights the File menu, but the menu is often only posted after I hit <Return> too. This is without any underlines in the menu, or explicit bindings done by me. If several menus start with the same letter, they are cycled through on repeated Alt-(letter).

LES I am too busy and up against a deadline now to inspect my old code and investigate this, but I certainly know that (under Windows at least) there are two possible menu styles: one is always gray and boring and "standard-looking" and the accelerators work, and the other is colored, way cool, but the accelerators don't work. I'll get back with more info if I can... :-(

RS Is that maybe about native vs. Tk menus? Anyway, here's a little standalone demo for a native menu (on Windows 2k), which has the wanted Alt-F behavior (and "standard look", but that's just right for me):

 . config -menu [menu .m]
 .m add cascade -label File -menu [menu .m.1 -tearoff 0]
 .m.1 add command -label Exit -command exit
 .m add cascade -label Options -menu [menu .m.2 -tearoff 0]
 .m.2 add command -label Foo -command exit

PWQ That works, but looks butt ugly under linux. It's a shame that Tk's cross platform functionality is not consistant.