File: bindui.htm

package info (click to toggle)
mh-book 9910-2
  • links: PTS
  • area: main
  • in suites: sarge, woody
  • size: 8,104 kB
  • ctags: 2,979
  • sloc: sh: 1,449; perl: 771; ansic: 279; makefile: 48; csh: 8
file content (122 lines) | stat: -rw-r--r-- 4,208 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<HTML>
<HEAD>
<META NAME="Author" CONTENT="Brent B. Welch">
<TITLE>MH &amp; nmh: Binding User Interface</TITLE>
</HEAD>
<!-- $Id: bindui.htm,v 6.0 1999/10/10 05:14:05 jpeek Exp $ -->

<BODY BGCOLOR="#FFFFFF">
<A NAME="index1"></A>
<H1>Binding User Interface</H1>
[<A HREF="presec.htm">previous</A>]
[<A HREF="mhprof.htm">next</A>]
[<A HREF="tocs/jump.htm">table of contents</A>] [<A HREF="indexes/map.htm">index</A>]
<P>

A number of keystroke bindings, already defined by
<I>exmh</I>, invoke different Tcl commands.
You can change the bindings and add bindings for new commands
via the Bind dialog.
Open the dialog from the <I>Commands</I> menu entry under the Bindings menu.
The dialog presents two columns of commands and their bindings,
plus an area at the top to define a new binding.
<A NAME="index2"></A>
<P>
<B>Binding Syntax</B>.
Here is a brief summary of the Tk bind syntax.
To get the complete story,
consult the Tk manual page for the <I>bind</I> command.
The Tk syntax for the bindings events is:
<PRE>
&lt;<I>modifier</I>-<I>type</I>-<I>detail</I>&gt;
</PRE>
In that syntax,
<UL>
<LI>
A <I>modifier</I> is a key that you hold down while pressing another key.
The modifiers you are likely to use are
<TT>Control</TT>,
<TT>Shift</TT>, and
<TT>Meta</TT>.
Capitalization of these keywords is significant -- that is, uppercase and
lowercase letters are not equivalent.
<LI>
The <I>type</I> is the event type; it can be left out if
the detail part implies it.
The types you'll usually use are
<TT>Key</TT> and
<TT>Button</TT>.
<LI>
The <I>detail</I> specifies the key or button number for the event.
Keys are named by their X keysym.
For the letters and digits, the keysym is just the letter or digit, e.g.,
<TT>&lt;Key-a&gt;</TT>, which can be shortened to <TT>&lt;a&gt;</TT>.
For punctuation, however, the keysyms are words.
Some examples are
<TT>&lt;comma&gt;</TT>,
<TT>&lt;period&gt;</TT>,
<!-- some internationalization problems; I'd like to skip: \f(CW&lt;dollar>\fP, -->
<TT>&lt;asciicircum&gt;</TT>,
<TT>&lt;question&gt;</TT>, and
<TT>&lt;exclam&gt;</TT>.
Again, the Key type is omitted.
<LI>
The capitalization used with the modifiers, types, and keysyms
is significant.
Watch out for keysyms like <TT>BackSpace</TT>!
</UL>
Perhaps the easiest way to figure out the keysym is to use the
following Tcl/Tk command.
Run the Tcl/Tk shell, <I>wish</I>, and enter the command shown in
<A HREF="#FiXKey">the next Example</A>.
A little window will open.
Type characters into that window, and you'll see keysym information
underneath the <I>wish</I> command line.
<P>
In the example below, after starting <I>wish</I> and typing the <TT>bind</TT>
command, I moved the mouse to the little window.
I pressed and held down the left &lt;Shift&gt; key,
pressed the &lt;g&gt; key and the &lt;dollar&gt; key,
released the &lt;Shift&gt; key, and pressed the &lt;q&gt; key.
I moved the mouse back to the shell window and typed &lt;Control-d&gt;
to quit <I>wish</I>.
<P>

<A NAME="FiXKey"><EM>Example: Finding an X keysym</EM></A><BR>
<PRE>
unix$ <B>wish</B>
% <B>bind . &lt;Any-Key&gt; {puts stdout "keysym = %K letter = %A"}</B>
% keysym = Shift_L letter = 
keysym = G letter = G
keysym = dollar letter = $
keysym = q letter = q
CTRL-D
unix$
</PRE>

<P>

<P ALIGN=CENTER>
[<A HREF="tocs/jump.htm">Table of Contents</A>] [<A HREF="indexes/map.htm">Index</A>]
[<A HREF="presec.htm">Previous: Preference Sections</A>]
[<A HREF="mhprof.htm">Next: MH Profile</A>]
</P>
<HR>
(This section was written by Brent Welch.)<BR>
<EM>Last change $Date: 1999/10/10 05:14:05 $</EM>
<P>
This file is from the third edition of the book <I>MH &amp; xmh: Email
for Users &amp; Programmers</I>, ISBN 1-56592-093-7, by Jerry Peek.
Copyright &copy; 1991, 1992, 1995 by O'Reilly &amp; 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
<A HREF="../copying.htm">the file <I>copying.htm</I></A>.
<P>
<ADDRESS>
Suggestions are welcome:
<A HREF="http://www.beedub.com/exmh/">Brent Welch</A>
<A HREF="mailto:welch@acm.org">&lt;welch@acm.org&gt;</A>
</ADDRESS>
</BODY>
</HTML>