In your interface, you want to handle a lot of events in the
subwidgets that make up your mega-widget. For instance, when somebody
presses the button in a TixArrowButton
widget, you want the button to
handle the event. The SetBindings
method is used to creates event
bindings for the components inside the mega-widget. In our
TixArrowButton example, we use the bind command to specify that the
method tixArrowButton:IncrCount
should be called each time when the
user presses the first mouse button. As a result, we can count the
number of times the user has pressed on the button.
proc tixArrowButton:SetBindings {w} { upvar #0 $w data tixChainMethod $w SetBindings bind $data(w:button) <1> \ "tixArrowButton:IncrCount $w" } proc tixArrowButton:IncrCount {w} { upvar #0 $w data incr data(count) }