Posted to tcl by evilotto at Wed Apr 13 02:01:56 GMT 2011view raw
- proc bindx_cmd {cmd ev} {
- {*}$cmd [dict filter $ev script {k v} {expr {$v != "??"}} ]
- }
- proc bindx {wid evt cmd} {
- bind $wid $evt [list bindx_cmd $cmd {
- serial %#
- above %a
- button %b
- count %c
- detail %d
- focus %f
- height %h
- window %i
- keycode %k
- mode %m
- override_redirect %o
- place %p
- state %s
- time %t
- width %w
- x %x
- y %x
- character %A
- border_width %B
- delta %D
- send_event %E
- keysym %K
- keysym_num %N
- property %P
- root %R
- subwindow %S
- type %T
- window %W
- xroot %X
- yroot %Y}]
- }
- proc a_cmd {clientdata evt} {
- puts "evt $clientdata: $evt"
- }
- label .a -text hello
- bindx .a <KeyRelease> {a_cmd one}
- bindx .a <1> {a_cmd button}
- bindx .a <Configure> {a_cmd conf}
- pack .a -expand t -fill both
- focus .a