Selection<A NAME=336> </A>

Next: Hierarchical Listbox Up: Creating Display Items Previous: Event Handling

### Selection

The `-selectmode` option controls how many items the user can select at one time. In the `single` and `browse` mode, the user can select only one item at a time. In the `multiple` and `extended` mode, the user can select multiple items; the `extended` mode allows disjoint selections while the `multiple` mode does not.

Normally, the user selects the items using the mouse or the keyboard. You can find out which items the user has selected with the `info selection` method, which returns a list of the currently selected items. You can also set the selection using the `selection set` method. For example, the command `.tlist selection set 3` selects the item whose index is `3`. The command `.tlist selection set 2 10` selects all the items at index `2` through `10`. The method `selection clear` empties the selection.