Subject: "ttk:menubutton -underline"
From: ZB
Date: 12/11/2007 8:33:27 PM
I noticed, that although I can point a letter using "-underline" option -
menu of the ttk::menubutton doesn't get pulled down, while pressing <Alt>
and the key of such underlined letter (no such problem while using f.e.
notebooks).
Is it a bug - or from some reason it's meant to be so?
--
ZB
Subject: "ttk:menubutton -underline"
From: Joe English
Date: 12/12/2007 2:54:49 PM
ZB wrote:
>
> I noticed, that although I can point a letter using "-underline" option -
> menu of the ttk::menubutton doesn't get pulled down, while pressing <Alt>
> and the key of such underlined letter (no such problem while using f.e.
> notebooks).
>
> Is it a bug - or from some reason it's meant to be so?
The -underline option only affects the display;
you still need to add keyboard bindings by hand.
Tk has a built-in binding on the "all" bindtag
that handles <Alt-KeyPress> accelerators for
core [menu] and [menubutton] widgets, but it
doesn't know about any other widget types.
One way to add an accelerator is to do something like:
ttk::menubutton $top.mb -text Foo -underline 0
bind $top <Alt-KeyPress-f> [list event generate $top.mb <<Invoke>>]
You can also use the keynav package [*] to
enable accelerators for all widgets in a toplevel:
package require keynav
keynav::enableMnemonics $top
keynav is included in Tile, also available
as a separate extension for 8.5 here:
<URL: http://tile-extras.googlecode.com/svn/trunk/tile-extras/keynav.tcl
--Joe English
|