Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

Tree Items

An item (also called row) is the term used to refer to one element added to the tree control and includes the row header, all pictures, tree lines, expand/collapse buttons and all cells.

Items are added using the AddString and InsertString functions.

Items within tree controls have relationships to other items based on the level they are on. This determines how items are connected to each other.

The following table defines the terms used throughout to identify relationships and the connecting lines drawn for each type:

TermDescription
DependentsA dependent is an item which has a parent. The item is said to be a dependent of the parent item. Dependents can be parent items themselves or leaf items. A dependent cannot be at the root level. The GetDependent function can be used to retrieve dependent item information for an item.
Expand StatusThe expand status indicates whether dependent items are visible or not. A parent item that has one or more visible dependents is considered expanded. If a parent item is expanded, all its immediate dependents, i.e., all dependents on the next lower level are visible. If a parent item is collapsed, no immediate dependents are visible. The GetItemExpand function returns the current expand status of an item.
Leaf ItemA leaf item is an item which has no dependents, i.e., it is not a parent item. Leaf items may have sibling and parent items.
ParentA parent item can be located at any level. In order to become a parent item, an item must be marked expandable (using SetItemExpandable) or have one or more dependents, which are items that immediately follow the parent item and are on a lower level. A parent item may be expanded and collapsed. Expanding a parent item means making its immediate dependents (items on the next lower level) visible. Collapsing a parent item means hiding all its dependents (on all lower levels). The Expand and Collapse functions are used to expand and collapse items. Parent items may have sibling and parent items. The GetParent function returns an item's parent index.
Root LevelAny item without parent is at the root level, usually level 0. Multiple items can be at the root level, parent items or leaf items. GetItemLevel can be used to retrieve an item's level number.
SiblingsA sibling is an item which precedes or follows another item on the same level with the same parent. An item can have zero or more sibling items. Sibling items can be parent and leaf items. The GetSibling functions can be used to retrieve sibling information about an item.
Top ParentA parent item is a top parent (or top level parent) if it has no parent of its own. Top parent items may have sibling items. The GetTopIndex function can be used to retrieve the topmost parent item.
Visibility StatusThe visibility status indicates whether an item is visible or not. An item is considered visible if its immediate and all other parent items are expanded. An item is considered visible even if it isn't currently displayed in the window client area. The GetItemShown and SetItemShown functions can be used to define an item's visibility status.

When adding items to a tree control, all that is required from an application is that the level numbers are set. The SftTree/DLL tree control automatically determines the correct relationships and draws connecting lines appropriately. Applications can then interrogate the tree control about relationships and don't have to manage these themselves.