Tk Library Source Code

Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


khim - Provides key bindings for entering international characters on a keyboard that does not support them

Table Of Contents


package require Tcl
package require khim ?1.0?

::khim::getOptions path
::khim::setConfig version enabled compose map
::khim::showHelp path


This package provides a set of key bindings to allow a user to enter arbitrary characters on a keyboard that does not support them. It works by designating some seldom-used key of the keyboard as a "Compose" key (this key is distinct from any key so labeled, and is often "Pause," "F12" or "L2"), and having the "Compose" key, followed by a two-key sequence, have the effect of inserting some character in a widget. In addition, the "Compose" key, when struck twice in succession, brings up a dialog containing a Unicode character map, allowing arbitrary characters to be inserted.

The vast bulk of the package's functionality is implemented in a single bindtag, KHIM. An application can request that any text or entry widget use the package to allow for entry of arbitrary characters by placing this binding tag ahead of the Text or Entry binding tag for the widget:

text .t -width 80 -height 24
bindtags .t {.t KHIM Text . all}

Note that the KHIM tag must precede the Text or Entry class binding, or the package will not function correctly.


In addition to commands supporting the KHIM binding tag, the following commands are exported from the package:


Programmers who wish to make KHIM available in a non-English-speaking locale may do so by providing a .msg file with the appropriate localised text. The catalog requires the following messages:


KHIM was originally inspired by the key bindings that Brent Welch developed for the 'sedit' editor used in the 'exmh' mail user agent. The code for KHIM is entirely separate from that for 'sedit'.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category khim of the Tklib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.


character, i18n, input, international, method