ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / TreeView control
  • Overview
  • Handling the elements of a TreeView control directly
  • WLanguage functions
  • Direct operation
  • Initializing an element in a TreeView control
  • Initializing an element
  • Associating a tooltip with an element
  • Selecting an element in a TreeView control
  • Selecting an element at row
  • Positioning on the last element of the TreeView control
  • Retrieving the element selected in the TreeView control
  • WLanguage properties associated with the elements of a TreeView control
  • Using properties on an element of a TreeView control
  • Examples
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Handling the elements of a TreeView control directly

WLanguage functions

In the WLanguage functions for managing TreeView controls, the element of the TreeView control is handled via its full path (from the root of the TreeView control). This path has the following format:
"<Root name>" + TAB + ["<Name of 1st node>" + TAB + ...
["<Name of 2nd node>" + TAB + [...]]]"<Leaf name>"
The different elements that constitute the path of characters strings are separated by TAB characters.
WINDEVJava

Direct operation

To manipulate an element of a TreeView control directly (with the WLanguage properties for example), two notations are available:
  • Operation performed via the index of the element:
    Just use the following notation: <Tree Field> [ <Item Index>].
    Please note: The specified indices only take into account visible elements..
    Example: Changing the color of the 5th element displayed in a TreeView control:
    TREE_MyTreeView[5].Color = LightRed
  • Operation performed via the full path of the element:
    Just use the following notation: <Tree Field> [ <Element Path>].
    The path of the element is a character string in the following format:
    "<Root name>" + TAB + ["<Name of 1st node>" + TAB + ...
    ["<Name of 2nd node>" + TAB + [...]]]"<Leaf name>"
    Example: Changing the color of the "Pineapple" element.
    TREE_MyTreeView["Recipe" + TAB + "Dessert" + TAB + "Pineapple"].Color = LightRed
Note: It is also possible to use the following notation to designate the current element of a TreeView control:
MySelf[TreeSelect(MySelf)]
Initializing an element in a TreeView control
WINDEVJava

Initializing an element

To initialize an element found in a TreeView control, use TreeAdd.
During this addition, you can:
WINDEVJava

Associating a tooltip with an element

To associate a tooltip with an element in a Treeview control, you can use:
If the element's tooltip text is not specified, the text displayed will be that of the TreeView control's tooltip (if it exists).
Reminder: By default, the tooltips associated with the various fields are displayed.. To specify whether the tooltips must be displayed or not, use ShowToolTip.
Selecting an element in a TreeView control
WINDEVJava

Selecting an element at row <Index>

To select the element at row <Index>, use:
  • direct assignment:
    <TreeView control> = Index

    If the row is displayed in the TreeView control, the corresponding element is selected.
  • the TreeSelectPlus function:
    TreeSelectPlus(<TreeView control>, <Full element name>)
WINDEVJava

Positioning on the last element of the TreeView control

To set the position on the last element of the TreeView control, use the Count property:
<TreeView control> = <TreeView control>.Count
Retrieving the element selected in the TreeView control
To retrieve:
  • the index of the selected element, use the direct reading of the element:
    Index = <TreeView control>
  • the full path of the selected element, use TreeSelect:
    <Path> = TreeSelect(<TreeView control>)
  • the identifier of the selected element, use TreeIdentifier.
WLanguage properties associated with the elements of a TreeView control
WINDEVJava

Using properties on an element of a TreeView control

Several WLanguage properties can be used on the elements of a TreeView control.
For a complete list of WLanguage properties that can be used on an element of a TreeView control, see Properties associated with a row of a TreeView control.
WINDEVJava

Examples

Example: How to modify the color of an element in a TreeView control:
TREE_MyTreeView[5].Color = LightRed

Example: How to modify the size of the font used for an element of a TreeView control:
TREE_MyTreeView["Recipe" + TAB + "Dessert" + TAB + "Pineapple"].FontSize = 14
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/04/2024

Send a report | Local help