subsection3_8_5.html
subsection3_8_4.html
subsubsection3_8_4_4.html
tableofcontents3_1.html
Next:
subsection3_8_5.html
Declaring and Using
Up:
subsection3_8_4.html
Standard Initialization Methods
Previous:
subsubsection3_8_4_4.html
The ConstructWidget Method
The SetBindings Method
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
(obviously for no better reasons than using it as a dumb example).
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)
}
http://tix.sourceforge.net
http://tix.sourceforge.net
