PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Branch of the leaf
  • Priority order for the sort
  • Duplicates
  • Format of collapsed/expanded images
  • Type of collapsed/expanded images
  • Tip regarding the images of branches
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Adds a "leaf" element (and all necessary nodes) into a TreeView control.
Example of TreeView control:
Vocabulary linked to a TreeView control
Example
// Add the "Ice cream" leaf into the "TREE_RecipeTV" control
Res = TreeAdd(TREE_RecipeTV, "Recipes" + TAB +  ...
"Desserts" + TAB + "Ice creams", ...
tvDefault, tvDefault, LeafID)
// Initialize the treeview
TreeAdd(TREE_Treeview1, "Root", tvDefault, tvDefault, "")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 1", tvDefault, tvDefault, "1")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 2", tvDefault, tvDefault, "2")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 3", tvDefault, tvDefault, "3")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 4", tvDefault, tvDefault, "4")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 2" + TAB +  ...
"Sub leaf 2-1", tvDefault, tvDefault, "5")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 2" + TAB +  ...
"Sub leaf 2-2", tvDefault, tvDefault, "6")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 2" + TAB +  ...
"Sub leaf 2-3", tvDefault, tvDefault, "7")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 2" + TAB +  ...
"Sub leaf 2-4", tvDefault, tvDefault, "8")
TreeAdd(TREE_Treeview1, "Root" + TAB + "Leaf 2" + TAB +  ...
"Sub leaf 2-5", tvDefault, tvDefault, "9")

// Select a treeview row
TreeSelectPlus(TREE_Treeview1, "Root" + TAB + "Leaf 2" + TAB +  ...
"Sub leaf 2-5")
Syntax
<Result> = TreeAdd(<TreeView Control> , <Leaf Path> [, <Collapsed Image> [, <Expanded Image> [, <Leaf Identifier> [, <Add Mode> [, <Tooltip Text>]]]]])
<Result>: Boolean
  • True if the leaf was added to the TreeView control,
  • False otherwise.
<TreeView Control>: Control name
Name of TreeView control to use.
<Leaf Path>: Character string
Full path of leaf that will be added into the TreeView control. This parameter has the following format:
"<Name of Root>" + 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>: 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:
    tvDefault
    (Default value)
    Default image (closed folder): Closed folder
    NullNo image
<Expanded Image>: Optional character string or constant
Image associated with the element. This image is displayed when the element is an expanded node (see the Notes). At run time, 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:
    tvDefault
    (Default value)
    Default image (opened folder): Opened folder
    NullNo image
<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: The TAB character is not allowed in the identifiers of elements.
<Add 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.
tvLastThe leaf is added in last position of level.
tvFirstThe leaf is added in first position of level.
tvAlphaSort
(Default value)
The added leaf is inserted in alphabetical order, among the elements of same level.
<Tooltip Text>: Optional character string (with quotes)
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.
Remarks

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. See Managing duplicates in the TreeView controls for more details.
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.
Management of duplicates
If an element that already exists is added into a level, TreeAdd returns False if the addition mode was not defined with the tvAcceptDuplicate constant. 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 of the tiff 6.0 standard 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)
    Versions 22 and later
    Notes:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
    New in version 22
    Notes:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
    Notes:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
  • Cursors (*.cur)
  • Portable Document Format (*.pdf)
  • Versions 15 and later
    Scalable Vector Graphics (*.svg)
    New in version 15
    Scalable Vector Graphics (*.svg)
    Scalable Vector Graphics (*.svg)
  • Versions 22 and later
    WINDEV images (generated by the image editor, *.WDPIC).
    New in version 22
    WINDEV images (generated by the image editor, *.WDPIC).
    WINDEV images (generated by the image editor, *.WDPIC).
Note: To manage the pdf and svg formats, GDIPLUS.DLL must be installed for the computers running Windows 2000 and earlier. For the later versions, this DLL is supplied with Windows. See GDI+ framework for more details.
Windows Mobile The recognized image formats are as follows: BMP, JPEG, GIF or ICO.
WEBDEV - Server code The recognized image formats are as follows: GIF, JPEG, PNG or SVG (depending on the browsers).

Type of collapsed/expanded images

The images used can be:
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.
WEBDEV - Server code Only the image files can be used. These files must be found 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: The size of images should be set to 16 x 16 pixels (size of small icons).

Tip regarding the images of branches

Caution: If the name of the image does not change between two calls to TreeAdd, the image is not reloaded in memory (even if its content has changed).
Example: The following code creates an image with the same name and with a different content, and it is using this image for each call to TreeAdd: 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)
TreeAdd(TREE_MyTreeView, "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
// Procedure used to create an image file
// whose type is "xx" + I + ".BMP"
// The content changes at each iteration
CreateImage(I)
TreeAdd(TREE_MyTreeView "xx", "xx" + I + ".BMP")
END
Components
WINDEVReports and Queries wd230obj.dll
WEBDEV - Server code wd230page.dll
Windows Mobile wp230obj.dll
Java wd230java.jar
Linux wd230obj.so
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment