~ubuntu-branches/ubuntu/trusty/mh-book/trusty

« back to all changes in this revision

Viewing changes to exmh/resmen.htm

  • Committer: Bazaar Package Importer
  • Author(s): Peter S Galbraith
  • Date: 2001-03-26 12:42:56 UTC
  • Revision ID: james.westby@ubuntu.com-20010326124256-philz6gf517qz8bo
Tags: upstream-9910
ImportĀ upstreamĀ versionĀ 9910

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<HEAD>
 
3
<META NAME="Author" CONTENT="Brent B. Welch">
 
4
<TITLE>MH &amp; nmh: Resources for Menus</TITLE>
 
5
</HEAD>
 
6
<!-- $Id: resmen.htm,v 6.0 1999/10/10 05:14:05 jpeek Exp $ -->
 
7
 
 
8
<BODY BGCOLOR="#FFFFFF">
 
9
<A NAME="index1"></A>
 
10
<H1>Resources for Menus</H1>
 
11
[<A HREF="resbut.htm">previous</A>]
 
12
[<A HREF="butgro.htm">next</A>]
 
13
[<A HREF="tocs/jump.htm">table of contents</A>] [<A HREF="indexes/map.htm">index</A>]
 
14
<P>
 
15
 
 
16
The menus in <I>exmh</I> are defined similarly to buttons.
 
17
Naturally, menus are a little more complex than buttons -- but
 
18
the general idea is the same.
 
19
There are parallel sets of resources for the two parts of menus:
 
20
system-defined and user-defined.
 
21
Each section has a list of menus defined
 
22
with the <I>menulist</I> and <I>umenulist</I>.
 
23
Each menu, in turn, has a <I>text</I> resource that defines
 
24
the label on the menu button.
 
25
The <I>entrylist</I> and <I>uentrylist</I> resources list
 
26
the entries that are found under the menu.
 
27
Again, the system-defined entries are listed under <I>entrylist</I>;
 
28
users should add new entries to <I>uentrylist</I>.
 
29
<P>
 
30
Each menu entry has resources with the following naming
 
31
convention (this is not standard Tk).
 
32
If the entrylist item is <I>foo</I>, then:
 
33
<UL>
 
34
<LI>
 
35
l_<I>foo</I> defines the label (text) for the entry.
 
36
<LI>
 
37
c_<I>foo</I> defines the command.
 
38
<LI>
 
39
t_<I>foo</I> defines the type: "command", "check", "radio", "cascade", or 
 
40
"separator".
 
41
<LI>
 
42
v_<I>foo</I> defines the variable associated with check and radio entries.
 
43
<LI>
 
44
m_<I>foo</I> defines the menu associated with cascade entries.
 
45
</UL>
 
46
To get more information, read the Tk
 
47
manual page for <I>menu</I>.
 
48
<P>
 
49
Here is an example -- the definition for the <I>exmh</I> main menus:
 
50
<PRE>
 
51
*Main.menulist:          bind help
 
52
 
 
53
*Main.bind.text:         Bindings...
 
54
*Main.bind.m.entrylist:  command sedit
 
55
*Main.bind.m.l_command:  Commands
 
56
*Main.bind.m.c_command:  Bind_Pref
 
57
*Main.bind.m.l_sedit:    Simple Edit
 
58
*Main.bind.m.c_sedit:    Sedit_Pref
 
59
 
 
60
*Main.help.text:         Help...
 
61
*Main.help.m.entrylist:  help colorkey faq
 
62
*Main.help.m.l_colorkey: Color Legend
 
63
*Main.help.m.c_colorkey: Help_KeyDisplay
 
64
*Main.help.m.l_help:     Quick Intro
 
65
*Main.help.m.c_help:     Help
 
66
*Main.help.m.l_faq:      Frequently Asked Questions
 
67
*Main.help.m.c_faq:      Help FAQ
 
68
</PRE>
 
69
Note the additional <TT>.m</TT> component in the
 
70
<TT>*Main.help.m.entrylist</TT> resource name.
 
71
The <TT>*Main.help</TT> resource corresponds to the menu button, and
 
72
<TT>*Main.help.m</TT> corresponds to the menu associated with that button.
 
73
<P>
 
74
Here's another example.
 
75
We'll use
 
76
the <I>uentrylist</I> resource to add a new menu entry to
 
77
the message <TT>More...</TT> menu.
 
78
It will be a check-button type of entry -- to set the Tcl
 
79
variable controlling the "skip marked" behavior of <TT>Next</TT> and
 
80
<TT>Prev</TT>.
 
81
We'll also separate the user-defined entries from the
 
82
system entries with a special separator menu entry.
 
83
The resources in your <I>~/.exmh-defaults</I> file
 
84
would look something like this:
 
85
<PRE>
 
86
*Mops.more.m.uentrylist: sep skip
 
87
*Mops.more.m.t_sep: separator
 
88
*Mops.more.m.t_skip: check
 
89
*Mops.more.m.l_skip: Skip marked messages
 
90
*Mops.more.m.v_skip: ftoc(skipMarked)
 
91
</PRE>
 
92
In this case, the Tcl variable is <I>ftoc(skipMarked)</I>,
 
93
an element of an associative Tcl array.
 
94
Menu entries that use Tcl variables defined by <I>exmh</I>
 
95
might stop working in a future release.
 
96
However, you can easily get an idea of what the important
 
97
variables are by searching through the code for Preferences_Add
 
98
calls.
 
99
These calls set up the relationship between the internal Tcl
 
100
variables and the Preference items you see in the interface.
 
101
In most cases, the variables are elements of an associative array.
 
102
In the example above, <I>ftoc</I> is the array that holds the state variables
 
103
for <I>ftoc.tcl</I>, which implements the table of contents.
 
104
<P>
 
105
 
 
106
<P ALIGN=CENTER>
 
107
[<A HREF="tocs/jump.htm">Table of Contents</A>] [<A HREF="indexes/map.htm">Index</A>]
 
108
[<A HREF="resbut.htm">Previous: Resources for Buttons</A>]
 
109
[<A HREF="butgro.htm">Next: Button Groups</A>]
 
110
</P>
 
111
<HR>
 
112
(This section was written by Brent Welch.)<BR>
 
113
<EM>Last change $Date: 1999/10/10 05:14:05 $</EM>
 
114
<P>
 
115
This file is from the third edition of the book <I>MH &amp; xmh: Email
 
116
for Users &amp; Programmers</I>, ISBN 1-56592-093-7, by Jerry Peek.
 
117
Copyright &copy; 1991, 1992, 1995 by O'Reilly &amp; Associates, Inc.
 
118
This file is freely available; you can redistribute it and/or modify
 
119
it under the terms of the GNU General Public License as published by
 
120
the Free Software Foundation.  For more information, see
 
121
<A HREF="../copying.htm">the file <I>copying.htm</I></A>.
 
122
<P>
 
123
<ADDRESS>
 
124
Suggestions are welcome:
 
125
<A HREF="http://www.beedub.com/exmh/">Brent Welch</A>
 
126
<A HREF="mailto:welch@acm.org">&lt;welch@acm.org&gt;</A>
 
127
</ADDRESS>
 
128
</BODY>
 
129
</HTML>