The menus in exmh are defined similarly to buttons. Naturally, menus are a little more complex than buttons -- but the general idea is the same. There are parallel sets of resources for the two parts of menus: system-defined and user-defined. Each section has a list of menus defined with the menulist and umenulist. Each menu, in turn, has a text resource that defines the label on the menu button. The entrylist and uentrylist resources list the entries that are found under the menu. Again, the system-defined entries are listed under entrylist; users should add new entries to uentrylist.
Each menu entry has resources with the following naming convention (this is not standard Tk). If the entrylist item is foo, then:
Here is an example -- the definition for the exmh main menus:
*Main.menulist: bind help *Main.bind.text: Bindings... *Main.bind.m.entrylist: command sedit *Main.bind.m.l_command: Commands *Main.bind.m.c_command: Bind_Pref *Main.bind.m.l_sedit: Simple Edit *Main.bind.m.c_sedit: Sedit_Pref *Main.help.text: Help... *Main.help.m.entrylist: help colorkey faq *Main.help.m.l_colorkey: Color Legend *Main.help.m.c_colorkey: Help_KeyDisplay *Main.help.m.l_help: Quick Intro *Main.help.m.c_help: Help *Main.help.m.l_faq: Frequently Asked Questions *Main.help.m.c_faq: Help FAQNote the additional .m component in the *Main.help.m.entrylist resource name. The *Main.help resource corresponds to the menu button, and *Main.help.m corresponds to the menu associated with that button.
Here's another example. We'll use the uentrylist resource to add a new menu entry to the message More... menu. It will be a check-button type of entry -- to set the Tcl variable controlling the "skip marked" behavior of Next and Prev. We'll also separate the user-defined entries from the system entries with a special separator menu entry. The resources in your ~/.exmh-defaults file would look something like this:
*Mops.more.m.uentrylist: sep skip *Mops.more.m.t_sep: separator *Mops.more.m.t_skip: check *Mops.more.m.l_skip: Skip marked messages *Mops.more.m.v_skip: ftoc(skipMarked)In this case, the Tcl variable is ftoc(skipMarked), an element of an associative Tcl array. Menu entries that use Tcl variables defined by exmh might stop working in a future release. However, you can easily get an idea of what the important variables are by searching through the code for Preferences_Add calls. These calls set up the relationship between the internal Tcl variables and the Preference items you see in the interface. In most cases, the variables are elements of an associative array. In the example above, ftoc is the array that holds the state variables for ftoc.tcl, which implements the table of contents.
[Table of Contents] [Index] [Previous: Resources for Buttons] [Next: Button Groups]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: <Brent.Welch@eng.sun.com>
HIVE: All information for read only. Please respect copyright! |