Multiple Matches |
||||
|
It is possible for several bindings to match a given X event. If the bindings are associated with different tags, then each of the bindings will be executed, in order. By default, a binding for the widget will be executed first, followed by a class binding, a binding for its toplevel, and an all binding. The tk/bindtags command may be used to change this order for a particular window or to associate additional binding tags with the window. The Note that If more than one binding matches a particular event and they have the same tag, then the most specific binding is chosen and its script is evaluated. The following tests are applied, in order, to determine which of several matching sequences is more specific:
If the matching sequences contain more than one event, then tests 3-5 are applied in order from the most recent event to the least recent event in the sequences. If these tests fail to determine a winner, then the most recently registered sequence is the winner. If there are two (or more) virtual events that are both triggered by the same sequence, and both of those virtual events are bound to the same window tag, then only one of the virtual events will be triggered, and it will be picked at random: (tk/event 'add '<<Paste>> '<Control-y>) (tk/event 'add '<<Paste>> '<Button-2> (tk/event 'add '<<Scroll>> '<Button-2> (tk/bind 'Entry '<<Paste>> (lambda () (print 'Paste))) (tk/bind 'Entry '<<Scroll>> (lambda () (print 'Scroll))) If the user types Control-y, the If an X event does not match any of the existing bindings, then the event is ignored. An unbound event is not considered to be an error. |