Resources for Menus

[previous] [next] [table of contents] [index]

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:

To get more information, read the Tk manual page for menu.

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

*         Help...
*  help colorkey faq
* Color Legend
* Help_KeyDisplay
*     Quick Intro
*     Help
*      Frequently Asked Questions
*      Help FAQ
Note the additional .m component in the * resource name. The * resource corresponds to the menu button, and * 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 section was written by Brent Welch.)
Last change $Date: 1996/06/06 15:13:31 $

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: <>