Posted to tcl by mjanssen at Wed Jan 23 13:30:46 GMT 2008view raw
- text .t
- pack .t
- bind .t <Control-V> {
- set uc_keys {}
- bindtags %W [list Unicode {*}[bindtags %W]]
- }
- variable uc_keys
- proc handle_uc_key {widget key} {
- puts handle_uc
- global uc_keys
- switch -nocase -regexp -- $key {
- {[0-9A-F]} {
- append uc_keys $key
- if {[string length $uc_keys] == 4} {
- $widget insert insert [subst \\u$uc_keys]
- bindtags $widget [lrange [bindtags $widget] 1 end]
- }
- return -code break
- }
- default {
- $widget insert insert $uc_keys
- bindtags $widget [lrange [bindtags $widget] 1 end]
- }
- }
- }
- bind Unicode <Key> {handle_uc_key %W %A}