Widget Instantiation
ConstructWidget: creates the subwidgets.
proc tixOnOff:ConstructWidget {w} {
upvar #0 $w data
tixChainMethod $w ConstructWidget
set data(w:on) [button $w.on -text On]
set data(w:off) [button $w.off -text Off]
pack $data(w:on) $data(w:off) -side left
}
A variable with name data(w:xxx) is assumed to be subwidget tags: it stores the pathname of a subwidget, which can be accessed by the “$w subwidget xxx” call.