Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

DeleteString

Deletes an item.

C

int WINAPI SftTree_DeleteString(HWND hwndCtl, int index);
int WINAPI SftTreeSplit_DeleteString(HWND hwndCtl, int index);

C++

int CSftTree::DeleteString(int index);
int CSftTreeSplit::DeleteString(int index);

Parameters

hwndCtl

The window handle of the tree control.

index

Specifies the zero-based index of the item to be deleted.

Returns

The return value is the number of items remaining in the tree control. The return value is -1 if an error occurred.

Comments

The DeleteString function deletes an item.

If a parent item is deleted, dependents are deleted if the parent item is collapsed (dependents are not visible). If the parent item is expanded when it is deleted, its dependents are not deleted.

If a deletion callback routine has been defined (see SetDeleteCallback), the callback is invoked for each item deleted from the tree control. This allows application specific cleanup processing to take place for each item.

The WM_SETREDRAW Windows message (CWnd::SetRedraw) can be used to suppress the tree control from being redrawn when many items are deleted. The use of WM_SETREDRAW is strongly recommended when deleting many items from the tree control, as it avoids significant processing while items are deleted and drastically reduces the time needed. WM_SETREDRAW (FALSE) should be used once, then all items should be deleted followed by one final WM_SETREDRAW (TRUE) message.

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

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