- 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
TreeView control linked to a data file
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.
Creating a Treeview control based on a data file
To create a TreeView control based on a data file:
- Create a TreeView control (on the "Creation" tab, in the "Data" group, click "TreeView").
- Open the control description window (select "Description" in the context menu).
- In the "Content" tab, select "File/Query".
- Click the "Add" button. A "<None>" source is automatically added.
- 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.
- 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.
- 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.
- Validate the description window of the Treeview control. The TreeView control is a browsing TreeView.
"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.
: To use this option on a TreeView control populated programmatically, call the AddChildDelayed
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.