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 / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones TreeView
  • Branch of the leaf
  • Priority order for the sort
  • Duplicates
  • Format of collapsed/expanded images
  • Type of collapsed/expanded images
  • Tip on branch images
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
Adds a "leaf" element (and all necessary nodes) into a TreeView control.
Example of TreeView control:
Vocabulary linked to a TreeView control
Ejemplo
// Ajout de la feuille "Glace" dans le champ Arbre "ARBRE_RecetteTV"
Res = TreeAdd(ARBRE_RecetteTV, "Recettes" + TAB + ...
"Desserts" + TAB + "Glaces", tvDefault, tvDefault, IDFeuille)
// Initialisation du champ Arbre
TreeAdd(ARBRE_Arbre1, "Racine", tvDefault, tvDefault, "")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 1", tvDefault, tvDefault, "1")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2", tvDefault, tvDefault, "2")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 3", tvDefault, tvDefault, "3")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 4", tvDefault, tvDefault, "4")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2" + TAB + ...
"Sous Feuille 2-1", tvDefault, tvDefault, "5")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2" + TAB + ...
"Sous Feuille 2-2", tvDefault, tvDefault, "6")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2" + TAB + ...
"Sous Feuille 2-3", tvDefault, tvDefault, "7")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2" + TAB + ...
"Sous Feuille 2-4", tvDefault, tvDefault, "8")
TreeAdd(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2" + TAB + ...
"Sous Feuille 2-5", tvDefault, tvDefault, "9")

// Sélection d'une ligne du champ Arbre
TreeSelectPlus(ARBRE_Arbre1, "Racine" + TAB + "Feuille 2" + TAB + "Sous Feuille 2-5")
Sintaxis
<Result> = TreeAdd(<TreeView control> , <Leaf path> [, <Collapsed image> [, <Expanded image> [, <Leaf identifier> [, <Addition mode> [, <Tooltip text>]]]]])
<Result>: Boolean
  • True if the leaf was added to the TreeView control,
  • False otherwise.
<TreeView control>: Control name
Name of the TreeView control to be used.
<Leaf path>: Character string
Full path of leaf that will be added into the TreeView control. This parameter is of the form:
"<Nom de la racine>" + TAB + ["<Nom du 1er noeud>" + TAB + ...
["<Nom du 2ème noeud>" + TAB + [...]]]"<Nom de la feuille>"
In case of duplicates on a path element, this path can contain the element identifier (specified after the leaf name by TreeID).
<Collapsed image>: Optional character string or constant
Image associated with the element. This image is displayed when the element is a collapsed node (see the Notes). At run time, the caption of a collapsed node is preceded by "+".
This parameter corresponds to:
  • the name and full (or relative) path of image. A UNC path can be used.
  • the constant:
    NullNo image
    tvDefault
    (Default value)
    Default image (closed folder):Closed folder
<Expanded image>: Optional character string or constant
Image associated with the element. This image is displayed when the element is an expanded node (see Notes). At runtime, the caption of an expanded node is preceded by "-".
This parameter corresponds to:
  • the name and full (or relative) path of image. A UNC path can be used.
  • the constant:
    NullNo image
    tvDefault
    (Default value)
    Default image (opened folder): Open folder
<Leaf identifier>: Character string or integer (optional)
Identifier associated with a specific element of the TreeView control. This parameter corresponds to an empty string ("") by default. To associate an identifier with an element that is already created, use TreeModify.
Caution:
  • This parameter is mandatory if a duplicate identifier management system has been set up..
  • The TAB character is not allowed in the identifiers of elements.
<Addition mode>: Optional constant (or combination of constants)
Position of added element (the leaf) in relation to the elements of same level in the TreeView control.
tvAcceptDuplicateThe duplicates are accepted (two elements on the same level can have the same name). The added leaf is inserted in alphabetical order, among the elements of same level.
tvAlphaSort
(Default value)
The added leaf is inserted in alphabetical order, among the elements of same level.
tvFirstThe leaf is added in first position of level.
tvLastThe leaf is added in last position of level.
<Tooltip text>: Optional character string
If this parameter is specified, its content will be displayed in a tooltip when the element is hovered by the mouse cursor. This parameter corresponds to an empty string ("") by default. If no tooltip is associated with the element, the tooltip associated with the TreeView control will be automatically displayed.
Observaciones

Branch of the leaf

If one of the higher levels for the added leaf does not exist and if it is not associated with an identifier (management of duplicates), this level is automatically added. The characteristics of this new level (or branch of the element) are as follows:
  • collapsed image and expanded image by default (tvDefault constant).
  • identifier equal to Null,
  • addition mode corresponding to the tvLast constant.
A WLanguage error occurs if one of the higher levels of the leaf is associated with an identifier and if this level does not exist or if it is not associated with this identifier. Indeed, the higher levels must be created with their respective identifiers before they can be handled.

Priority order for the sort

The priority order of parameters for the add mode is as follows:
  • tvFirst
  • tvLast
  • tvAlphaSort
For example, in tvFirst + tvLast + tvAlphaSort, only the tvFirst constant is taken into account.

Duplicates

Accepting duplicates must be done with great care (tvAcceptDuplicate constant. Indeed, a specific identifier must be managed to identify the level where the addition must be performed. For more details, see Managing duplicates in the TreeView controls.
Some inconsistencies may occur if this management is not performed.
For example: If two "Level 2" exist, into which one will "Level 3" be added? There is no way to find out which "Level 2" must be used. By default, the add operation will be performed in the first element found.
Duplicate management
If an element that already exists is added into a level, TreeAdd returns False if the mode to define the element was not defined with the tvAcceptDuplicate constant. The element is not added.

Format of collapsed/expanded images

WINDEV Los siguientes formatos de Image están soportados en Windows:
  • Mapa de bits (*.BMP)
  • Formato de intercambio de gráficos (*.gif)
  • Grupo Mixto de Expertos en Fotografía (*.jpg *;.jpeg)
  • CD de fotos Kodak (*.pcd)
  • Pincel de pintura (*.pcx)
  • Formato Adobe Photoshop (*.psd)
  • TrueVision TARGA (*.tga)
  • Etiquetado en el formato de archivo Image (*.tif ; *.Tiff)
    Observación: la opción "tiff de mosaico" del estándar tiff 6.0 no está soportada. En este caso, le aconsejamos que guarde el Image en el estándar Tiff 5.0.
  • Gráficos de red portátiles (*.png)
  • MetaFicheros de Windows (*.emf;*.wmf)
  • Iconos (*.ico *;.icw)
    Observaciones:
    • Pantalla HQ (High Quality) disponible.
    • Manejo de hojas en formato Transparent BMP (32 bits).
  • Cursores (*.cur)
  • Formato portátil de Document (*.pdf)
  • Gráficos vectoriales escalables (*.svg)
  • WINDEV Image s (generado por el editor de Image, *.WDPic).

Type of collapsed/expanded images

The images used can be:
  • image files,
  • items of a "Binary Memo" HFSQL data file containing an image.
  • drawings created by the graphic string functions.
The specified image is proportionally resized to 16 x 16 pixels: in most cases, the height of the image corresponds to the height of TreeView row. Remark: The size of images should be set to 16 x 16 pixels (size of small icons).

Tip on branch images

Caution: If the image name does not change between two calls to TreeAdd, the image is not reloaded in memory (even if its content changed).
Example: The following code creates an image with the same name and with a different content, and it uses this image for each call to TreeAdd: in this case, the same image will always be used.
FOR I = 1 TO 10
// Procédure permettant de créer un fichier image de type xx.BMP
// Le contenu change à chaque itération
CréerImage(I)
TreeAdd(ARBRE_MonArbre, "xx", "xx.BMP")
END
Solution: To use the proper image, you must give a new name whenever a new image is created. For example:
FOR I = 1 TO 10
// Procédure permettant de créer un fichier image
// de type "xx" + I + ".BMP"
// Le contenu change à chaque itération
CréerImage(I)
TreeAdd(ARBRE_MonArbre, "xx", "xx" + I + ".BMP")
END
Componente: wd290obj.dll
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: 03/01/2024

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