Next: Event Handling Up: Creating Display Items Previous: Configuring and Deleting


Choosing the Orientation and Number of Rows or Columns 

There are three options that controls the layout of the items in the TixTList widget. The -orientation option can be set to either vertical or horizontal. When -orientation is set to vertical, the items are laid out vertically from top down and wrapped to the next column when the bottom is reached (see figure 3-6). The opposite layout policy is chosen if -orientation is set to horizontal (see figure 3-6).

When the -orientation option is set to vertical, normally the number of columns displayed depends on the number of items in the TixTList widget: the more items there are, the more columns will there be. However, we can use the -columns option to control the number of columns: the items will be wrapped in a way so that the number of columns produced will be exactly as dicated by the -columns option.

One use of the -columns option is to specify the same layout policy as that of the standard Tk listbox widget. We can do this by setting -orientation to vertical and -columns to 1. This way we can get a replacement listbox widget that can display multiple fonts and colors and graphics!

The counterpart of the -columns option is the -rows option, which is used for the same purpose when the -orientation option is set to horizontal.

(Figure 3-6) The -orientation option of the TixSelect Widget