GNU Info

Info Node: (elisp)Mouse Menus

(elisp)Mouse Menus


Next: Keyboard Menus Prev: Defining Menus Up: Menu Keymaps
Enter node , (file) or (file)node

Menus and the Mouse
-------------------

   The usual way to make a menu keymap produce a menu is to make it the
definition of a prefix key.  (A Lisp program can explicitly pop up a
menu and receive the user's choice--see Note: Pop-Up Menus.)

   If the prefix key ends with a mouse event, Emacs handles the menu
keymap by popping up a visible menu, so that the user can select a
choice with the mouse.  When the user clicks on a menu item, the event
generated is whatever character or symbol has the binding that brought
about that menu item.  (A menu item may generate a series of events if
the menu has multiple levels or comes from the menu bar.)

   It's often best to use a button-down event to trigger the menu.  Then
the user can select a menu item by releasing the button.

   A single keymap can appear as multiple menu panes, if you explicitly
arrange for this.  The way to do this is to make a keymap for each pane,
then create a binding for each of those maps in the main keymap of the
menu.  Give each of these bindings an item string that starts with `@'.
The rest of the item string becomes the name of the pane.  See the
file `lisp/mouse.el' for an example of this.  Any ordinary bindings
with `@'-less item strings are grouped into one pane, which appears
along with the other panes explicitly created for the submaps.

   X toolkit menus don't have panes; instead, they can have submenus.
Every nested keymap becomes a submenu, whether the item string starts
with `@' or not.  In a toolkit version of Emacs, the only thing special
about `@' at the beginning of an item string is that the `@' doesn't
appear in the menu item.

   You can also produce multiple panes or submenus from separate
keymaps.  The full definition of a prefix key always comes from merging
the definitions supplied by the various active keymaps (minor mode,
local, and global).  When more than one of these keymaps is a menu,
each of them makes a separate pane or panes (when Emacs does not use an
X-toolkit) or a separate submenu (when using an X-toolkit).  Note:
Active Keymaps.


automatically generated by info2www version 1.2.2.9