Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemExpandable

Defines whether an item is expandable.

C

BOOL WINAPI SftTree_GetItemExpandable(HWND hwndCtl, int index);
BOOL WINAPI SftTree_SetItemExpandable(HWND hwndCtl, int index, BOOL fExpandable);
BOOL WINAPI SftTreeSplit_GetItemExpandable(HWND hwndCtl, int index);
BOOL WINAPI SftTreeSplit_SetItemExpandable(HWND hwndCtl, int index, BOOL fExpandable);

C++

BOOL CSftTree::GetItemExpandable(int index) const;
BOOL CSftTree::SetItemExpandable(int index, BOOL fExpandable = TRUE);
BOOL CSftTreeSplit::GetItemExpandable(int index) const;
BOOL CSftTreeSplit::SetItemExpandable(int index, BOOL fExpandable = TRUE);

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the item for which the expandable status is to be retrieved or set.

fExpandable

Set to TRUE to make the item an expandable item or FALSE to collapse the item and delete all dependents.

Returns

GetItemExpandable returns TRUE if the item is expandable, FALSE if the item doesn't have any dependents.

SetItemExpandable returns TRUE if the function was successful, otherwise FALSE is returned.

Comments

The GetItemExpandable and SetItemExpandable functions define whether an item is expandable.

Normally, only a parent item (with dependents) is expandable. Instead of adding dependent items, an item can be made a parent item using the SetItemExpandable function. An expandable item displays an expand/collapse button and displays a suitable item picture.

A leaf item can be made a "temporary" parent item by using SetItemExpandable(TRUE). The item now displays an expand/collapse button and other attributes, such as the item picture, even though no dependents are present. The item can be expanded by the application in response to a SFTTREEN_-style notification. The application can then add child items as the user expands this "temporary" parent item, making it into a real parent item.

When using SetItemExpandable, dependents are always removed unless the item is already expanded.

When using SetItemExpandable(FALSE), the item is collapsed (and its dependents are removed).

When using SetItemExpandable(TRUE) and the item is already expanded and has dependents, the item remains unchanged.

An item's expand/collapse button can be hidden using the SetItemExpandCollapseButton function.

In a tree control using a virtual data source, SetItemExpandable cannot be used and an error is returned.

See Also C/C++ API | Categories | Notifications