ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / TreeView control
  • Overview
  • How to?
  • Creating a Treeview control based on a data file
  • "Populate sub-levels dynamically" option
  • Manipulating a TreeView control based on a data file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
You have the ability to create TreeView controls directly linked to the data.
You can create a TreeView control based on a data file: the TreeView control will be linked to a data file or to a query.
The programming of the TreeView controls is simplified: there is no need to use the TreeXXX functions directly.
How to?

Creating a Treeview control based on a data file

To create a TreeView control based on a data file:
  1. Create a TreeView control (on the "Creation" tab, in the "Data" group, click "TreeView").
  2. Open the control description window (select "Description" in the context menu).
  3. In the "Content" tab, select "File/Query".
  4. Click "Add". A "<None>" source is automatically added.
  5. Define the characteristics of this source:
    • Source: corresponds to the data file or query that will be looped through.
    • Iterate: corresponds to the search key used to loop through the data source.
    • Display: corresponds to the item displayed in the TreeView control.
  6. Add (if necessary) a second source for the next level ("Add" button). In this case, you have the ability to define the source of the link for the previous level.
    For example, if the first level loops through the Customer data file, the second one can loop through the Orders data file. The items that will be used to set the relation are "Customer.CustomerID" and "Orders.CustomerID". By default, the source of the link is automatically deduced from the items and links defined in the analysis.
  7. Define as many sources as necessary.
    Special case: Recursive TreeView control based on a data file
    A TreeView control based on a data file can display records that depend on the previous record (standard case of a recursive link used to manage the parents and the children for example).
    To manipulate this type of TreeView control, you can define a reflexive link in the "Content" tab of the TreeView control description window.
  8. Validate the TreeView control description window. The TreeView control is based on a data file.
WINDEV

"Populate sub-levels dynamically" option

When a TreeView control based on a data file contains many elements and subelements, it can take a long time to be populated.
The "Populate sub-levels dynamically (faster)" option populates each sub-level only when the user expands a level. The population time is optimized and it takes less time to populate the control the first time.
Note: To use this option on a TreeView control populated programmatically, call the AddChildDelayed property.
Manipulating a TreeView control based on a data file
You can easily manipulate TreeView controls based on a data file:
  • If the TreeView control can be edited, the changes made to the control are automatically reflected to the bound data source.
  • If the TreeView control does not allow user input, the bound data source will not be modified.
Minimum version required
  • Version 16
Comments
Click [Add] to post a comment

Last update: 03/27/2024

Send a report | Local help