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
  • "Delayed fill of sub-levels" option
  • Handling 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 the "Add" button. A "<None>" source is automatically added.
  5. Define the characteristics of this source:
    • Source: corresponds to the data file or to the query that will be browsed.
    • Browse: corresponds to the search key used to browse the source.
    • Displayed: 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 browses the Customer data file, the second one can browse the Orders data file for example. The items that will be used to set the link 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 manage this type of TreeView control, you have the ability to define a reflexive link in the "Content" tab of the description window of the TreeView control.
  8. Validate the description window of the Treeview control. The TreeView control is a browsing TreeView.
WINDEV

"Delayed fill of sub-levels" option

When a Treeview control based on a data file contains a large number of elements and sub-elements, filling it may take some time.
The "Delayed fill of sub-levels (faster)" option is used to fill each sub-level only when the user clicks to expand a level. In this case, the filling time is spread out and the initial fill is much faster.
Remark: To use this option on a TreeView control populated programmatically, call the AddChildDelayed property.
Handling a TreeView control based on a data file
A browsing TreeView control can be easily handled:
  • If the browsing Treeview control allows the modification, the modifications performed in the Treeview control will be automatically carried over into the linked data source.
  • If the TreeView control based on a data file does not allow the input, the linked data source will not be modified by the user directly.
Minimum version required
  • Version 16
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help