An "attached to container" widget is one that gets
resized whenever the widget it is attached to
The syntax is
The above skeleton example illustrates how one widget, 'w2' is
attached to another, 'w1'. Whenever widget 'w2' is resized
then widget 'w1' will be resized by a similar amount.
In the demo section of the bambookit website, we demontrate the
attach to container functionality. A pratical application of this
feature can be found in the table sample.
The first column (listbox) of the table is attached to container both
horizontally and vertically.
All subsequent columns (listboxes) are attached to the container
The first column, if it is resized (horizontal displacement)
then the table gets adjusted horizontally by the same amount (expanded
or contracted along the x-axis). If an additional
row gets added, the listbox automatically gets lengthened by the
height of that row, this will also expand the table vertically by the same
All the remaining columns, after the first column,
updates the table only along the x-axis, thus whenever the
columns get resized then so does the table container get
resized. Note: if we also allowed the listboxes
to resize the table container along the y axis whenever
we add or remove rows, this will cause a problem.
How so? If there are 3 columns then and all three update
the container along the vertical axis then the table
will grow (or shrink) 3 times the row height that is
added or removed.
Attach to container is an 'attachment' by the child TO the parent
which adjusts the parents size whenever the child changes size.
Note: the observer/observerable relationship of attachToContainer
is opposite (reverse) as compared to the attachToWidget attribute.