comparison man/lispref/menus.texi @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 7d59cb494b73
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
7 @node Menus, Dialog Boxes, Keymaps, Top 7 @node Menus, Dialog Boxes, Keymaps, Top
8 @chapter Menus 8 @chapter Menus
9 @cindex menu 9 @cindex menu
10 10
11 @menu 11 @menu
12 * Menu Format:: Format of a menu description. 12 * Menu Format:: Format of a menu description.
13 * Menubar Format:: How to specify a menubar. 13 * Menubar Format:: How to specify a menubar.
14 * Menubar:: Functions for controlling the menubar. 14 * Menubar:: Functions for controlling the menubar.
15 * Modifying Menus:: Modifying a menu description. 15 * Modifying Menus:: Modifying a menu description.
16 * Pop-Up Menus:: Functions for specifying pop-up menus. 16 * Pop-Up Menus:: Functions for specifying pop-up menus.
17 * Menu Filters:: Filter functions for the default menubar. 17 * Menu Filters:: Filter functions for the default menubar.
18 * Menu Accelerators:: Using and controlling menu accelerator keys 18 * Menu Accelerators:: Using and controlling menu accelerator keys
19 * Buffers Menu:: The menu that displays the list of buffers. 19 * Buffers Menu:: The menu that displays the list of buffers.
20 @end menu 20 @end menu
21 21
22 @node Menu Format 22 @node Menu Format
23 @section Format of Menus 23 @section Format of Menus
24 @cindex menu format 24 @cindex menu format
239 239
240 For example: 240 For example:
241 241
242 @example 242 @example
243 ("File" 243 ("File"
244 :filter file-menu-filter ; file-menu-filter is a function that takes 244 :filter file-menu-filter ; file-menu-filter is a function that takes
245 ; one argument (a list of menu items) and 245 ; one argument (a list of menu items) and
246 ; returns a list of menu items 246 ; returns a list of menu items
247 [ "Save As..." write-file] 247 [ "Save As..." write-file]
248 [ "Revert Buffer" revert-buffer :active (buffer-modified-p) ] 248 [ "Revert Buffer" revert-buffer :active (buffer-modified-p) ]
249 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ] 249 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
250 ) 250 )
251 @end example 251 @end example
598 accelerator key for a menu is used to activate that menu when it appears as a 598 accelerator key for a menu is used to activate that menu when it appears as a
599 submenu of another menu. An accelerator key for a menu item is used to 599 submenu of another menu. An accelerator key for a menu item is used to
600 activate that item. 600 activate that item.
601 601
602 @menu 602 @menu
603 * Creating Menu Accelerators:: How to add accelerator keys to a menu. 603 * Creating Menu Accelerators:: How to add accelerator keys to a menu.
604 * Keyboard Menu Traversal:: How to use and modify the keys which are used 604 * Keyboard Menu Traversal:: How to use and modify the keys which are used
605 to traverse the menu structure. 605 to traverse the menu structure.
606 * Menu Accelerator Functions:: Functions for working with menu accelerators. 606 * Menu Accelerator Functions:: Functions for working with menu accelerators.
607 @end menu 607 @end menu
608 608
609 @node Creating Menu Accelerators 609 @node Creating Menu Accelerators
610 @subsection Creating Menu Accelerators 610 @subsection Creating Menu Accelerators
611 611
618 618
619 For example, the command 619 For example, the command
620 620
621 @example 621 @example
622 (add-submenu nil '("%_Test" 622 (add-submenu nil '("%_Test"
623 ["One" (insert "1") :accelerator ?1 :active t] 623 ["One" (insert "1") :accelerator ?1 :active t]
624 ["%_Two" (insert "2")] 624 ["%_Two" (insert "2")]
625 ["%_3" (insert "3")])) 625 ["%_3" (insert "3")]))
626 @end example 626 @end example
627 627
628 will add a new menu to the top level menubar. The new menu can be reached 628 will add a new menu to the top level menubar. The new menu can be reached
629 by pressing "t" while the top level menubar is active. When the menu is 629 by pressing "t" while the top level menubar is active. When the menu is
630 active, pressing "1" will activate the first item and insert the character 630 active, pressing "1" will activate the first item and insert the character
706 @example 706 @example
707 (setq menu-accelerator-prefix ?\C-x) 707 (setq menu-accelerator-prefix ?\C-x)
708 (setq menu-accelerator-modifiers '(meta control)) 708 (setq menu-accelerator-modifiers '(meta control))
709 (setq menu-accelerator-enabled 'menu-force) 709 (setq menu-accelerator-enabled 'menu-force)
710 (add-submenu nil '("%_Test" 710 (add-submenu nil '("%_Test"
711 ["One" (insert "1") :accelerator ?1 :active t] 711 ["One" (insert "1") :accelerator ?1 :active t]
712 ["%_Two" (insert "2")] 712 ["%_Two" (insert "2")]
713 ["%_3" (insert "3")])) 713 ["%_3" (insert "3")]))
714 @end example 714 @end example
715 715
716 will add the menu "Test" to the top level menubar. Pressing C-x followed by 716 will add the menu "Test" to the top level menubar. Pressing C-x followed by
717 C-M-T will activate the menubar and display the "Test" menu. Pressing 717 C-M-T will activate the menubar and display the "Test" menu. Pressing
718 C-M-T by itself will not activate the menubar. Neither will pressing C-x 718 C-M-T by itself will not activate the menubar. Neither will pressing C-x