MH & nmh: Resources for Buttons
Author: Brent B. Welch

# Resources for Buttons

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

exmh uses X resources to specify its buttons and menus on the main display, the editor window, and the `What Now` dialog. You can add a button to one of these areas of the user interface by listing it in a ubuttonlist resource and adding resources that describe the button. X resource names are hierarchical; these are the button list resources used by exmh:

    *Main.ubuttonlist
    *Fops.ubuttonlist
    *Mops.ubuttonlist
    *Sedit.Menubar.ubuttonlist
    *WhatNow.ubuttonlist

These resources are necessary because there's no easy way to enumerate the contents of the resource database.

When exmh starts up, it asks for the definition of both buttonlist and ubuttonlist resources. app-defaults has definitions for its buttons under the buttonlist resource; users should add new buttons with the ubuttonlist resource. To remove some system buttons, you have to override the definition of the buttonlist resource. This is best explained by an example. Here are the definitions for the main buttons:

    *Main.buttonlist:	quit pref alias
    *Main.quit.text:	Quit
    *Main.quit.command:	Exmh_Done
    *Main.pref.text:	Preferences
    *Main.pref.command:	Preferences_Dialog
    *Main.alias.text:	Aliases
    *Main.alias.command:	Aliases_Pref

The *Main.buttonlist resource names the buttons that appear in the top row of buttons. The value of the *Main.buttonlist resource, in turn, causes exmh to look for other resources that define the text and command attributes for each button. The command is a Tcl command; most are simple commands of one or two words. If you are really inspired, you can set many different attributes of a Tk button via resources -- get the details from the Tk manual page for button.

The next example adds a `Repl` button to the message buttons. By default, there are a few variations on `Reply` under the `Reply...` menu. You might like a `Repl` button for your most common form of reply. The Msg_Reply Tcl command takes regular arguments for the MH repl program.

    *Mops.ubuttonlist: myrepl
    *Mops.myrepl.text: Repl
    *Mops.myrepl.command: Msg_Reply -filter myrepl.filter -cc all

See the Section Replying to Mail with repl for an overview of repl. Beware of repl options like -query that prompt you and expect an interactive response; these will lock up exmh. The MH Reference Guide has a summary of repl options.

[Table of Contents] [Index] [Previous: Widget Class Hierarchy] [Next: Resources for Menus]

(This section was written by Brent Welch.)
Last change $Date: 1999/10/10 05:14:05 $

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.