package require khim text .t -width 80 -height 24 bindtags .t {.t KHIM Text . all} entry .e -width 30 bindtags .e {.e KHIM Entry . all}There are commands that an application can call to bring up a control panel for KHIM (allowing for changes to the key bindings), to bring up user help for KHIM, and to save and restore the KHIM key bindings.I wrote KHIM for several reasons:
- On some machines, I'm not allowed, or don't know how, to change the system's input method to get the characters I want.
- I don't want to have to learn the input methods for all the systems I use.
- I occasionally have use for some pretty bizarre characters, and an "Insert Symbol"-style function comes in handy in most applications that deal with Unicode text.
RS Wouldn't it be more robust to do the bindtags invocation like this instead:
bindtags $w [linsert [bindtags $w] 1 KHIM]
KBK Maybe - although the default list of bindtags has been stable since bindtags were introduced, so I don't think that changes are very likely.What I do in apps in practice is:
rename ::entry ::khim::entry rename ::text ::khim::text proc ::entry {w args} { eval [linsert $args 0 ::khim::entry $w] bindtags $w [list $w KHIM Entry [winfo toplevel $w] all] return $w } proc ::text {w args} { eval [linsert $args 0 ::khim::text $w] bindtags $w [list $w KHIM Text [winfo toplevel $w] all] return $w }I should maybe export a khim::wrap procedure to allow apps to set this up by default, but I worried that perhaps some apps would want different bindings in one place from another. That's probably sufficiently user-hostile that the possibility should be ignored. I'll think about it some more.