** Summary ** A [Tk] command ** Synopsis ** : '''[event add]''' '''''<<'''virtual'''>>''' sequence'' ?''sequence ...''? : '''[event delete]''' '''''<<'''virtual'''>>''''' ?''sequence sequence ...''? : '''[event generate]''' ''window event'' ?''option value option value ...''? : '''[event info]''' ?'''''<<'''virtual'''>>'''''? ** Documentation ** [http://www.tcl.tk/man/tcl/TkCmd/event.htm%|%man page]: ** See Also ** * [bind] * [bindtags] * [event-oriented programming] ** Examples ** *** Atl-F4 (Windows) *** ====== event generate . ;# sudden death, somehow like [exit] ====== However, other Alt-(initial) events don't work when called from '''event''', only from the keyboard. ---- [MG]: A small proc I wrote for something. It takes two arguments, a window and a [http://www.tcl.tk/man/tcl/TkCmd/keysyms.htm%|%keysym], 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 explanation up a little after looking at the proc, please go ahead, it's not particularly coherent :) ====== 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; } text .t eventchk .t Text { tk::TextInsert %W \n if {[%W cget -autoseparators]} {%W edit separator} } bind .t {puts "You pressed return" ; break} eventchk .t .t {puts "You pressed return" ; break"} ====== [MG] 2005-08-02: 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... ** Misc ** 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