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 / ¿Cómo proceder? / Programación
  • TreeAdd function: Add an element at any position
  • Code samples
  • TreeInsert function: Insert an element at a specific position
  • Code example
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
A TreeView control is used to represent data hierarchically (on several levels). For example, a TreeView control can represent products groupd by Family then Sub-family.
To populate a TreeView control programmatically, you must use:
TreeAdd function: Add an element at any position
TreeAdd is used to add an element into a TreeView control. An element is made of:
  • Root: represents the first level of the element
  • Branch(es): represents the intermediate level(s)
  • Sheet: represents the data to be sorted
An element is represented in the following format:
Racine + TAB + Branche 1 + TAB + Branche 2 + TAB + ... + TAB + Feuille
The syntax of TreeAdd is as follows:
ArbreAjoute(<Nom Arbre>, <élément>, <image enroulée>, <image déroulée>, <identifiant>)
For more details, see the help page on the TreeAdd function.

Code samples

  • Fill through programming:
    TreeAdd(ARBRE_Ville, "France")
    TreeAdd(ARBRE_Ville, "Italie")
    TreeAdd(ARBRE_Ville, "France" + TAB + "Paris")
    TreeAdd(ARBRE_Ville, "France" + TAB + "Marseille")
    TreeAdd(ARBRE_Ville, "France" + TAB + "Lyon")
    TreeAdd(ARBRE_Ville, "France" + TAB + "Montpellier")
    TreeAdd(ARBRE_Ville, "Italie" + TAB + "Rome")
    TreeAdd(ARBRE_Ville, "Italie" + TAB + "Pise")
    TreeAdd(ARBRE_Ville, "Italie" + TAB + "Milan")
    TreeAdd(ARBRE_Ville, "Espagne" + TAB + "Barcelone")
    TreeAdd(ARBRE_Ville, "Espagne" + TAB + "Madrid")
    TreeAdd(ARBRE_Ville, "Espagne" + TAB + "Valence")
  • Fill from a data file:
    // Lecture familles
    FOR EACH Famille
    	// Ajout de la famille dans l'arbre (niveau 1: racine) 
    	TreeAdd(ARBRE_Produits, Famille.libellé)
    
    	// Lecture des sous-familles
    	FOR EACH SousFam where IDFamille = Famille.IdFamille
    		// Ajout de la sous-famille (niveau 2: branche 1) 
    		TreeAdd(ARBRE_Produits, Famille.libellé + TAB + SousFam.libellé)
    
    		// Lecture des produits
    		FOR EACH PRODUIT where IdSousFam = SousFam.IdSousFam
    			// Ajout du produit: (feuille)
    			TreeAdd(ARBRE_Produits, 
    				Famille.libellé + TAB + SousFam.libellé + TAB + PRODUIT.LibProd)
    		END
    	END
    END
TreeInsert function: Insert an element at a specific position
TreeInsert is used to insert a leaf in relation to another leaf (brother leaf).
The syntax of TreeInsert is as follows:
ArbreInsère(<Nom Arbre>, <Feuille frère>, <Nouvelle feuille>,
<Image enroulée>, <Image déroulée>, <Identifiant>)
For more details, see the help page on the TreeInsert function.

Code example

TreeAdd(ARBRE_Ville, "France")
TreeAdd(ARBRE_Ville, "Italie")
TreeAdd(ARBRE_Ville, "France" + TAB + "Paris")
TreeAdd(ARBRE_Ville, "France" + TAB + "Marseille")
TreeAdd(ARBRE_Ville, "France" + TAB + "Lyon")

// Insère les villes de Montpellier et Bordeaux au même niveau que Lyon
TreeInsert(ARBRE_Ville, "France" + TAB + "Lyon", "Montpellier")
TreeInsert(ARBRE_Ville, "France" + TAB + "Lyon", "Bordeaux")
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: 21/09/2024

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