Web page hosting and cheap domain registration service
  

 

Binding User Interface

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

A number of keystroke bindings, already defined by exmh, invoke different Tcl commands. You can change the bindings and add bindings for new commands via the Bind dialog. Open the dialog from the Commands 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.

Binding Syntax. Here is a brief summary of the Tk bind syntax. To get the complete story, consult the Tk manual page for the bind command. The Tk syntax for the bindings events is:

<modifier-type-detail>

In that syntax,

  • A modifier is a key that you hold down while pressing another key. The modifiers you are likely to use are Control, Shift, and Meta. Capitalization of these keywords is significant -- that is, uppercase and lowercase letters are not equivalent.
  • The type is the event type; it can be left out if the detail part implies it. The types you'll usually use are Key and Button.
  • The detail 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., <Key-a>, which can be shortened to <a>. For punctuation, however, the keysyms are words. Some examples are <comma>, <period>, <asciicircum>, <question>, and <exclam>. Again, the Key type is omitted.
  • The capitalization used with the modifiers, types, and keysyms is significant. Watch out for keysyms like BackSpace!

Perhaps the easiest way to figure out the keysym is to use the following Tcl/Tk command. Run the Tcl/Tk shell, wish, and enter the command shown in the next Example. A little window will open. Type characters into that window, and you'll see keysym information underneath the wish command line.

In the example below, after starting wish and typing the bind command, I moved the mouse to the little window. I pressed and held down the left <Shift> key, pressed the <g> key and the <dollar> key, released the <Shift> key, and pressed the <q> key. I moved the mouse back to the shell window and typed <Control-d> to quit wish.

Example: Finding an X keysym

unix$ wish
% bind . <Any-Key> {puts stdout "keysym = %K letter = %A"}
% keysym = Shift_L letter = 
keysym = G letter = G
keysym = dollar letter = $
keysym = q letter = q
CTRL-D
unix$

[Table of Contents] [Index] [Previous: Preference Sections] [Next: MH Profile]


 

 

 

Cheap domains registrar | Buy domain name & domain registration | Domain registration 

Disclaimers: This document is provided as free service for the benefits of Active-Venture.com's web hosting customers only.

 
Quotes: People are very open-minded about new things--as long as they're exactly like the old ones.