AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / Desarrollar una aplicación o un sitio web / Controles, ventanas y páginas / Controles: tipos disponibles / Control TreeView
  • Colapsar/Expandir un TreeView mediante programación
  • Ejemplo
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Colapsar/Expandir un TreeView mediante programación
  • Para colapsar una control TreeView a través de la programación utilice TreeCollapse.
  • Para ampliar un TreeView mediante programación, utilice TreeListItem con un Procedure local específico.
Ejemplo
Se utilizan los siguientes códigos para:
  • Inicializar una control TreeView.
  • expandir parte de la control TreeView.
  • colapsar la control TreeView.
  1. Inicie el control TreeView programando:
    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")
  2. Expandir todos los elementos: El procedimiento "ExpandAll" se llama por cada "hijo" encontrado. Esta Procedure expande todos los nodos "niños" colapsados del nodo "Postre"....
    // Lists the "children" of "Desserts" node in "TREE_TVRecipe" treeview
    // The "ExpandAll" procedure is called
    // for each "child" of "Desserts" node found
    Res = TreeListItem(TREE_TVRecipe, "Recipe" + TAB + "Dessert", "ExpandAll")
    // Local procedure named "ExpandAll"
    // This procedure expands all the collapsed "child" nodes of the "Desserts" node
    PROCEDURE ExpandAll(TREE_TVRecipe, ChildPath, ChildFound, Level, Pointer)
    // Is the element found a leaf?
    IF TreeTypeItem(TREE_TVRecipe, ChildPath + ChildFound) = tvLeaf THEN
    RETURN  // Back to TreeListItem
    ELSE
    // Is the element found collapsed?
    IF TreeStatus(TREE_TVRecipe, ChildPath + ChildFound) = tvCollapse THEN
    TreeExpand(TREE_TVRecipe, ChildPath + ChildFound)
    END
    END
  3. Colapsar el nodo "Dessert.
    // Collapses the "Desserts" node in the "TREE_TVRecipe" control
    Res = TreeCollapse(TREE_TVRecipe, "Recipe" + TAB + "Dessert")
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local