PC SOFT

WINDEV的在线文档

  • Collapsing/Expanding a treeview by programming
  • Example
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Collapsing/Expanding a treeview by programming

Collapsing/Expanding a treeview by programming
  • To collapse a treeview by programming, all you have to do is use 树视图收起.
  • To expand a treeview by programming, all you have to do is use 树视图子元素列表 combined with a specific local procedure.
19版本和更高版本
WinDev Note: To optimize the filling of a TreeView control, you have the ability to use ..添加子元素 on the rows of the TreeView control. This property is used to define the procedure that will be run to fill the level to expand. The search for children and the fill of children are performed only when the user wants to see them.
19新版本
WinDev Note: To optimize the filling of a TreeView control, you have the ability to use ..添加子元素 on the rows of the TreeView control. This property is used to define the procedure that will be run to fill the level to expand. The search for children and the fill of children are performed only when the user wants to see them.
WinDev Note: To optimize the filling of a TreeView control, you have the ability to use ..添加子元素 on the rows of the TreeView control. This property is used to define the procedure that will be run to fill the level to expand. The search for children and the fill of children are performed only when the user wants to see them.

Example
The following codes are used to:
  • initialize a TreeView control.
  • expand part of the TreeView control.
  • collapse the TreeView control.
  1. Initialize the TreeView control by programming:

    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert""CAKE-.BMP""CAKE-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Ice cream"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Ice cream"+...
    TAB+"Vanilla""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Ice cream"+...
    TAB+"Strawberry""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Ice cream"+...
    TAB+"Chocolate""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Cup"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Cup"+...
    TAB+"Banana Split""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Cup"+...
    TAB+"Cherry Garcia""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Cup"+...
    TAB+"Colonel""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Apple pie"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Apple pie"+...
    TAB+"with whipped cream""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Apple pie"+...
    TAB+"with apple brandy""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Crème brûlée""NEXT5-.BMP"
    树视图添加TREE_RecipeTV"Recipe"+TAB+"Dessert"+TAB+"Meringue with cream""NEXT5-.BMP"
  2. Expand all the elements: The "ExpandAll" procedure is called for each "child" element found. This procedure expands all the collapsed "child" nodes of the "Dessert" node.

    // Lists the "children" of the "Desserts" node in "TREE_RecipeTV"
    // The "ExpandAll" procedure is called
    // for each "child" of the "Desserts" node found
    Res树视图子元素列表TREE_RecipeTV"Recipe"+TAB+"Dessert""ExpandAll"

    // Local procedure named "ExpandAll"
    // This procedure expands all the collapsed "child" nodes of the "Desserts" node
    过程ExpandAllTREE_RecipeTVChildPathChildFoundLevelPointer
    // Is the element found a leaf?
    如果树视图元素类型TREE_RecipeTVChildPath+ChildFound)=树视图.叶子,那么
    返回// Back to TreeListItem
    否则
    // Is the element found collapsed?
    如果树视图状态TREE_RecipeTVChildPath+ChildFound)=树视图.收起,那么
    树视图展开TREE_RecipeTVChildPath+ChildFound
    结束
    结束
  3. Collapse the "Dessert" node.

    // Collapses the "Desserts" node in "TREE_RecipeTV"
    Res树视图收起TREE_RecipeTV"Recipe"+TAB+"Dessert"