: '''[event add]''' '''''<<'''virtual'''>>''' sequence'' ?''sequence ...''? : '''[event delete]''' '''''<<'''virtual'''>>''''' ?''sequence sequence ...''? : '''[event generate]''' ''window event'' ?''option value option value ...''? : '''[event info]''' ?'''''<<'''virtual'''>>'''''? ---- http://purl.org/tcl/home/man/tcl8.4/TkCmd/event.htm ---- Tested to work on Windows: event generate . ;# sudden death, somehow like [exit] However, other Alt-(initial) events don't work when called from '''event''', only from the keyboard. ---- A small proc I wrote for something. It takes two argument, a window and a keysym (http://www.purl.org/tcl/home/man/tcl8.4/TkCmd/keysyms.htm), and returns a two-element list. Assuming that some action is defined for the window, the first element is /what/ the [binding] is to, and the second is the command actually run. If someone wants to clean my explaination up a little after looking at the proc, please go ahead, it's not particularly coherent :) -- [MG] (%1) proc eventchk {w s} { set ret [list "" ""] ; set list [list "" ""] set tags [bindtags $w] while { $ret == $list && $tags != "" } { if { [bind [lindex $tags 0] $s] != "" } { set ret [list [lindex $tags 0] [bind [lindex $tags 0] $s]] } else { set tags [lrange $tags 1 end] } } return $ret; } (%2) text .t (%3) eventchk .t Text { tk::TextInsert %W \n if {[%W cget -autoseparators]} {%W edit separator} } (%4) bind .t {puts "You pressed return" ; break} (%5) eventchk .t .t {puts "You pressed return" ; break"} [MG] uses this again on August 2nd 2005 and finds one small "bug" - if a keysym is bound to an event (ie, -> <>), searching for won't find it. (Searching for <> will, but since the point of this is to find where and why a binding fires, that's not too helpful.) I'm not sure of a way around that, apart from checking [[[bind] $window]] for all events, and checking all of those to see if they fire on the binding, though... ---- See also: * [bind] * [bindtags] * [event-oriented programming] ---- Harold Macmillan (former UK prime minister, when asked what might most easily steer a government off course): ''Events, dear boy, events.'' ---- !!!!!! [Arts and Crafts of Tcl-Tk Programming] %| [Tk syntax help] | [Category Command] |% !!!!!!