ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / TreeView control
  • Events managed by default
  • Events supported by WINDEV and WINDEV Mobile
  • Events managed by WEBDEV
  • Special case: Collapsing/Expanding a node
  • Optional events
  • Filtering records (browsing TreeView control only)
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
Events associated with TreeView controls
Events managed by default
WINDEVJava

Events supported by WINDEV and WINDEV Mobile

WINDEV and WINDEV Mobile manage the following events by default (order of appearance in the code editor):
EventRuntime condition
InitializationRun when the window is opened. Used to initialize the content of the TreeView control for example. (*)
End of initializationCode only found for the browsing TreeView controls automatically filled:
Run once the TreeView control was filled. This code is used to expand or collapse an element.
EntryRun when the mouse cursor is positioned on the TreeView control.
ExitRun when the control is no longer selected.
ClickRun when the user clicks an element of the TreeView control.
Caution: When a double click is performed on an element, the click code and the double-click code are run successively.
Enter a row in inputRun when the user selects a row to perform an input in this row.
Caution: This code is available only if the input is allowed by the TreeView control.
Row exitRun when moving from one row or control to another (TAB key, selecting another control with the mouse, etc.).
Caution: This code is available only if the input is allowed by the TreeView control.
Row displayRun when a new row must be displayed in the TreeView control.
Selecting a rowRun when a new element is selected in the TreeView control.
Right clickRun when the user performs a right click on the TreeView control (or on one of its elements).
Double clickRun when the user performs a double click on the TreeView control (or on one of its elements).
Collapsing/Expanding a nodeRun when a branch of the TreeView control is expanded or collapsed via a click or a double click performed by the user or via the + or - icons.

Caution: When a click or double-click occurs, this event is executed with the "Click" event. This event is run before the desired action is performed.

Remark: This event can accept parameters (see below).
Filtering records
(optional event)
Event taken into account for browsing TreeView controls only
Run just before displaying a row. This event filters the records displayed in the TreeView control. This event is detailed at the end of this page.

(*) By default, the "Initializing" event of each control is run according to the order in which the controls were created in the window. To modify this order of execution:
  1. On the "Window" tab, in the "Order" group, click "Initialization".
  2. In the window displayed, use the arrows on the right to modify the order in which the controls are initialized.
WEBDEV - Server codeWEBDEV - Browser codeAjax

Events managed by WEBDEV

WEBDEV manages the following events by default (order of appearance in the code editor):
EventRuntime condition
InitializationRun when the window is opened. Used to initialize the content of the TreeView control for example.
Click (browser)Run on the computer of the Web user when the user clicks an element of the TreeView control.
Click (server)Run on the server when the user clicks an element of the TreeView control.
Special case: Collapsing/Expanding a node
WINDEVJava The event"Collapsing/Expanding a node" is run when the user collapses or expands a branch of the TreeView control with a click or double click.
Caution: This event must not delete the current node.
This event can accept parameters.
To handle these parameters, a procedure must be declared directly in the event "Collapsing/Expanding a node".
The procedure must be declared with the following syntax:
PROCEDURE <Procedure name>([<Element path> [, <Collapsed> [, <Identifier> ]]])
Where
<Element path>Text variable, containing the full path of the element currently collapsed or expanded. Simply specify the name of a variable. It will be automatically initialized at runtime.
<Collapsed>Boolean variable, used to find out the action performed by the user (collapse = True, expand = False). Simply specify the name of a variable. It will be automatically initialized at runtime.
<Identifier>Text variable, containing the identifier of the element currently collapsed or expanded. Simply specify the name of a variable. It will be automatically initialized at runtime. The identifier is provided when TreeAdd is called.
Java A procedure can be declared in the event "Collapsing/Expanding a node"
Example:
Optional events
WINDEVJava To add an optional event:
  1. Select the desired control.
  2. Display the code window of this control (F2 key).
  3. Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
  4. All the optional events available for the control are displayed.
  5. Check the optional event to add and validate.
    Remark: You can select several optional events.
  6. The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete.
Remark: If the disabled code contains WLanguage code, this code is automatically deleted.
You can manage, for example:
  • the mouse hover over the control,
  • left mouse button down, up, with a double click,
  • right mouse button down, up, double click,
  • the mouse wheel.
Filtering records (browsing TreeView control only)
WINDEV The event "Filtering the records" is run right after a row of the TreeView control is displayed. Therefore, it is run:
  • when initializing the TreeView control.
  • whenever displaying a new row of the TreeView control.
This event filters the records displayed in the TreeView control.
To implement a filter, the event "Filtering the records" must return a value:
  • True to specify that the record matches to the filter and that it must be displayed.
  • False to specify that the record does not match the filter and that it must not be displayed.
  • Cancel to stop reading the data source of the TreeView control (very rare case).
Example:
// -- Filtrage des enregistrements --
// Affiche uniquement les clients dont commandes sont supérieures Ã  3000 euros
IF Commande.TotalTTC >= 3000 THEN 
RETURN True
ELSE
RETURN False
END
In this code, the data used affects the record currently read by the TreeView control. This data comes from the date file or from the query linked to the TreeView control.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help