Next: The SetBindings Method Up: Standard Initialization Methods Previous: 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`)`.