On Microsoft Windows and GTK+ you can control the mnemonics in menu titles and menu items using the initargs :mnemonic
, :mnemonic-title
(and if necessary :mnemonic-escape
).
This example illustrates the various ways you can specify the mnemonics in a menu:
(contain
(make-instance
'menu
:mnemonic-title "M&nemonics"
:items
(list
(make-instance 'menu-item
:data "Menu Item 1"
:mnemonic #\1)
(make-instance 'menu-item
:data "Menu Item 2"
:mnemonic 10)
(make-instance 'menu-item
:mnemonic-title "Menu Item &3")
(make-instance 'menu-item
:mnemonic-title "Menu Item !4"
:mnemonic-escape #\!)
(make-instance 'menu-item
:data "Menu Item 5"
:mnemonic :default)
(make-instance 'menu-item
:data "Menu Item 6"
:mnemonic :none))))
On Microsoft Windows you may need to press Alt
to make the underlines appear.
This example shows two ways to specify menu title mnemonics within the :menus
option of a define-interface form. The first way, using :mnemonic
, is the most natural:
(capi:define-interface menu-bar-mnemonics ()
()
(:panes (pane1 capi:text-input-pane
:visible-min-width 200))
(:layouts (main-layout
capi:column-layout '(pane1)))
(:menus
(menu1 "Menu One"
(("Foo"))
:mnemonic #\O)
(menu2 nil
(("Bar"))
:mnemonic-title "Menu &Two"))
(:menu-bar menu1 menu2))
(capi:display (make-instance 'menu-bar-mnemonics))
CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017