|
|
|
|
|
- Collapsing/Expanding a TreeView programmatically
- Example
Collapsing/Expanding a TreeView control programmatically
Collapsing/Expanding a TreeView programmatically - To collapse a TreeView control through programming use TreeCollapse.
- To expand a TreeView through programming, use TreeListItem with a specific local procedure.
The following codes are used to: - initialize a TreeView control.
- expand part of the TreeView control.
- collapse the TreeView control.
- Initialize the TreeView control programmatically:
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert", "CAKE-.BMP", "CAKE-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Ice cream")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Ice cream" + ...
TAB + "Vanilla", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Ice cream" + ...
TAB + "Strawberry", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Ice cream" + ...
TAB + "Chocolate", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Cup")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Cup" + ...
TAB + "Banana Split", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Cup" + ...
TAB + "Cherry Garcia", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Cup" + ...
TAB + "Colonel", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Apple pie")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Apple pie" + ...
TAB + "with whipped cream", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Apple pie" + ...
TAB + "with apple brandy", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Crème brûlée", "NEXT5-.BMP")
TreeAdd(TREE_TVRecipe, "Recipe" + TAB + "Dessert" + TAB + "Meringue with cream", "NEXT5-.BMP")
- Expand all elements. The "ExpandAll" procedure is called for each "child" element found. This procedure expands all the collapsed "child" nodes of the "Dessert" node.
Res = TreeListItem(TREE_TVRecipe, "Recipe" + TAB + "Dessert", "ExpandAll")
PROCEDURE ExpandAll(TREE_TVRecipe, ChildPath, ChildFound, Level, Pointer)
IF TreeTypeItem(TREE_TVRecipe, ChildPath + ChildFound) = tvLeaf THEN
RETURN
ELSE
IF TreeStatus(TREE_TVRecipe, ChildPath + ChildFound) = tvCollapse THEN
TreeExpand(TREE_TVRecipe, ChildPath + ChildFound)
END
END
- Collapse the "Dessert" node.
Res = TreeCollapse(TREE_TVRecipe, "Recipe" + TAB + "Dessert")
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|