Updated 2011-12-09 01:36:29 by RLE

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 consistent.

RS If you mean the Motif look with butt-ugly, that used to be the same over all platforms, until from 8.0 or so, native menus etc. were used on Windows and Mac. But there are no standard "native widgets" in X11 ...

PWQ It's just how much space the menu takes up more than anything else. Given the flexibility of TK, and the availability of options, there seems no reason to have gone to using native components for dialogs et al.

Now there are two ways of making menus , neither one being 100% usable.

An aproach that changed the 'defaults' for menu buttons and popups that mimicked platform specific looks/feel would have mean't that people that wanted a different behaviour could had gotten it.

Another example, is the openFile dialogs, every major application under windows has its own so why use the native one. And now with starkits you cannot browse the kit files under windows/mac because you are not in tcl anymore.