subsubsection3_8_4_5.html
subsection3_8_4.html
subsubsectionstar3_8_4_3.html
tableofcontents3_1.html
Next:
subsubsection3_8_4_5.html
The SetBindings Method
Up:
subsection3_8_4.html
Standard Initialization Methods
Previous:
subsubsectionstar3_8_4_3.html
The tixChainMethod call
The ConstructWidget Method
The
ConstructWidget
method is used to creates 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
