Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Selection

A SftTree/NET tree control supports single and multiple item and cell selection based on the SftTree.SelectionStyle property settings.

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 SelectionChanged event.

The area where a selection change occurs can be defined using the SftTree.SelectableArea property.

An item can be selected using the ItemClass.Selected property, a cell is selected using the CellClass.Selected property. Multiple items or cells can be using the SftTree.SelectRange method. The selected item or cell can be retrieved using the SftTree.SelectedCell, SftTree.SelectedItem or SftTree.SelectedObjects properties.

The SftTree.SelectionOutlineStyle property defines the appearance of the selection highlight, either using the defined background/foreground colors or using a beveled, gradient outline style (see SftTree.SelectionOutlineStyle, SftTree.SelectionFill1, SftTree.SelectionFill2, SftTree.SelectionHighlightStyle, SftTree.SelectionInnerBorder, SftTree.SelectionOutlineBorder).

Single Selection

In single selection mode, only one item or cell can be selected (highlighted) at a time. When a new item is selected, the previously selected item or cell is then no longer selected. The current position (or caret location) is automatically selected.

Multiple Selection

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/cells can be selected using the mouse by clicking anywhere on the area defined by the SftTree.SelectableArea 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/cells is selected, from the first selected item/cell to the newly selected item/cell. If the Shift and the Control keys are pressed, a range of items/cells is added to the previous selection(s).

The SftTree.SelectedObjects property returns the selected items/cells. The SftTree.SelectRange method can be used to select or deselect a range of items.