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
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
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
// Add the "Ice cream" leaf into the "TREE_TVRecipe" control
Res = TREE_TVRecipe.Add("Recipes" + TAB + ...
		"Desserts" + TAB + "Glaces", aDefault, aDefault, IDFeuille)
// Initialize the TreeView control
TREE_TreeView1.Add("Root", tvDefault, tvDefault, "")
TREE_TreeView1.Add("Root" + TAB + "Leaf 1", tvDefault, tvDefault, "1")
TREE_TreeView1.Add("Root" + TAB + "Leaf 2", tvDefault, tvDefault, "2")
TREE_TreeView1.Add("Root" + TAB + "Leaf 3", tvDefault, tvDefault, "3")
TREE_TreeView1.Add("Root" + TAB + "Leaf 4", tvDefault, tvDefault, "4")
TREE_TreeView1.Add("Root" + TAB + "Leaf 2" + TAB + ...
		"Sub Leaf 2-1", tvDefault, tvDefault, "5")
TREE_TreeView1.Add("Root" + TAB + "Leaf 2" + TAB + ...
		"Sub Leaf 2-2", tvDefault, tvDefault, "6")
TREE_TreeView1.Add("Root" + TAB + "Leaf 2" + TAB + ...
		"Sub Leaf 2-3", tvDefault, tvDefault, "7")
TREE_TreeView1.Add("Root" + TAB + "Leaf 2" + TAB + ...
		"Sub Leaf 2-4", tvDefault, tvDefault, "8")
TREE_TreeView1.Add("Root" + TAB + "Leaf 2" + TAB + ...
		"Sub Leaf 2-5", tvDefault, tvDefault, "9")

// Select a TreeView row
TREE_TreeView1.SelectPlus("Root" + TAB + "Leaf 2" + TAB + "Sub Leaf 2-5")
Sintaxis
<Result> = <TreeView control>.Add(<Leaf path> [, <Collapsed image> [, <Expanded image> [, <Leaf identifier> [, <Addition mode> [, <Tooltip text>]]]]])
<Result>: booleano
  • True if the leaf was added to the TreeView control,
  • False otherwise.
<TreeView control>: Nombre del control
Name of the TreeView control to be used.
<Leaf path>: Cadena de caracteres
Full path of leaf that will be added into the TreeView control. This parameter has the following format:
"<Root name>" + TAB + ["<Name of 1st node>" + TAB + ...
["<Name of 2nd node>" + TAB + [...]]]"<Leaf name>"
In case of duplicates on a path element, this path can contain the element identifier (specified after the leaf name by TreeID).
<Collapsed image>: Cadena de caracteres opcional o constante
Image associated with the element. This image is displayed when the element is a collapsed node (see the Notes). At runtime, 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>: Cadena de caracteres opcional o constante
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>: Cadena de caracteres o entero (opcional)
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 <TreeView>.Modificar.
Caution:
  • This parameter is mandatory if a management of duplicates by identifier has been set up..
  • The TAB character is not allowed in the identifiers of elements.
<Addition mode>: Constante o combinación de constantes opcional
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>: Cadena de caracteres opcional
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 there are two "Level 2s", which one should you add "Level 3" to? Impossible to find which "Level 2" to manipulate. By default, the add operation will be performed in the first element found.
Duplicate management
When adding an existing element to a level, the function <TreeView>.Add returns False if the addition mode has not been defined with the constant aAcceptDoublon. The element is not added.

Format of collapsed/expanded images

WINDEV The following image formats are supported in Windows:
  • Bitmap (*.BMP)
  • Graphics Interchange Format (*.gif)
  • Joint Picture Experts Group (*.jpg ; *.jpeg)
  • Kodak Photo CD (*.pcd)
  • PaintBrush (*.pcx)
  • Adobe Photoshop Format (*.psd)
  • TrueVision TARGA (*.tga)
  • Tagged Image File Format (*.tif ; *.tiff)
    Note: the "Tiled TIFF" option in TIFF 6.0 is not supported. In this case, we advise you to save the image in tiff 5.0 standard.
  • Portable Network Graphics (*.png)
  • Windows MetaFiles (*.emf ; *.wmf)
  • Icons (*.ico ; *.icw)
    Remarks:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
  • Cursors (*.cur)
  • Portable Document Format (*.pdf)
  • Scalable Vector Graphics (*.svg)
  • WINDEV images (generated by the image editor, *.WDPIC).
  • Novedad versión 2025
    Images in WebP format (*.webp).
WEBDEV - Código Servidor The following image formats are supported: GIF, JPEG, PNG or SVG (depending on the browser).

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 with the graphic string functions.
The specified image is scaled down to 16 x 16 pixels: in most cases, the height of the image corresponds to the height of the line in the TreeView control.
WEBDEV - Código Servidor Only image files can be used. These files must be in the "<ProjectName>_WEB" directory. These images are not transformed when the page is saved. There is no need to use fWebDir to specify the image path. This path is relative to the "<ProjectName>_WEB" directory.
Note We recommend using 16 x 16 pixel images (size of small icons).

Tip on branch images

Warning: If the image name does not change between two calls to the <TreeView>.Addfunction, the image is not reloaded into memory (even if its content has changed).
Example The following code creates an image with the same name, but different content, and uses this image for each call to the function <TreeView>.Add In this case, the same image will always be used.
FOR I = 1 TO 10
	// Procedure used to create an xx.BMP image file
	// The content changes at each iteration
	CreateImage(I)
	TREE_MyTreeView.Add("xx", "xx.BMP")
END
Solution: To use the correct image, a new name must be given for each new image created.. For example:
FOR I = 1 TO 10
	// Procedure used to create an image file 
	// whose type is "xx" + I + ".BMP"
	// The content changes at each iteration
	CreateImage(I)
	TREE_MyTreeView.Add("xx", "xx" + I + ".BMP")
END
Componente: wd300obj.dll
Versión mínima requerida
  • Versión 23
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 06/12/2024

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