A SftTree/OCX tree control supports single and multiple selection based on the Items.MultiSelect property settings. The Items.SelectStyle and Items.OutlineStyle properties determine the visual appearance of the selection.
The user can change the selection in a tree control by using the arrow keys, PgUp, PgDn, Home, End, etc. As the selection changes, an application receives a SelectionChange event.
In single selection mode, only one item can be selected (highlighted) at a time. When a new item is selected, the previously selected item is then no longer selected. The current position (or caret location) is automatically selected, except while a drag & drop operation is in progress. The caret location indicates the drop target and the selected item is the source. Drag & drop can cause the caret location to be a deselected item. This behavior can be affected by the Items.DropHighlightStyle property.
Items can be selected using the mouse, by clicking anywhere on the item to be selected, from row header (leftmost position) to the right side of the window area. Moving the caret location using the arrow keys also automatically selects the item at the new caret location.
Depending on the Items.SelectionArea setting used, items can be selected using the mouse by clicking anywhere on the item to be selected, from row header (leftmost position), label graphic to the right side of the window area. Moving the caret location, using the arrow keys, also automatically selects the item at the caret location.
In multiple selection mode, many items can be selected (highlighted) at the same time. The current position (or caret location) is automatically moved to the new location when clicking anywhere on an item.
Items can be selected using the mouse by clicking anywhere on the area defined by the Items.SelectionArea property or by using the arrow keys. The new selection replaces the previous selection. If the CONTROL key is used, the selection is added to previous selections. If the SHIFT key is used, the entire range of items is selected, from the first selected item to the newly selected item. If the SHIFT and the CONTROL keys are pressed, a range of items is added to the previous selection(s).
The Items.SelectionCount property returns the number of selected items. The Items.Selection property returns the index of selected items. The Items.SelectionGroupStart and Items.SelectionGroupEnd methods are used to retrieve groups of selected items. The Item.Selected property returns an item's selection status. The Items.SelectRange method can be used to select or deselect a range of items.