subsubsection3_4_5_2.html
subsectionstar3_4_5.html
subsectionstar3_4_5.html
tableofcontents3_1.html
Next:
subsubsection3_4_5_2.html
The SetBindings Method
Up:
subsectionstar3_4_5.html
Chaining Methods
Previous:
subsectionstar3_4_5.html
Chaining Methods
The ConstructWidget Method
The
ConstructWidget
method is used to create the components of a
widget instance. In the case of
TixArrowButton
, we want to create a
new button subwidget, whose name is
button
, and use a bitmap to
display an arrow on this button. Assuming the bitmap files are stored
in the files up.xbm, down.xbm, left.xbm and right.xbm, the string
substitution
@$data(-direction).xbm
will give us the appropriate
bitmap depending on the current direction option of the widget
instance.
proc tixArrowButton:ConstructWidget {w} {
upvar #0 $w data
tixChainMethod $w ConstructWidget
set data(w:button) \
[button $w.button \
-bitmap @$data(-direction).xbm]
pack $data(w:button) \
-expand yes -fill both
}
The
tixArrowButton:ConstructWidget
method shown above sets the
variable
data(w:button)
to be the pathname of the button subwidget. As
a convention of the Tix Intrinsics, we must declare a public subwidget
swid
by storing its pathname in the variable
data(w:swid)
.
http://tix.sourceforge.net
http://tix.sourceforge.net
