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
  • Default events
  • Events supported by WINDEV and WINDEV Mobile
  • Events supported in WEBDEV
  • Special case: Winding/unwinding a knot
  • Optional events
  • Filtering records (TreeView control based on a data file only)
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Events associated with TreeView controls
Default events
WINDEVJava

Events supported by WINDEV and WINDEV Mobile

The following events appear by default in the WINDEV and WINDEV Mobile code editor:
EventRuntime condition
InitializationExecuted when the window is opened. Used to initialize the content of the TreeView control for example. (*)
End of initializationCode present only for automatically filled TreeView control fields:
Run once the TreeView control was filled. This code is used to expand or collapse an element.
EntryExecuted when the mouse cursor is positioned on the TreeView control.
ExitExecuted when the control is no longer selected.
ClickExecuted when the user clicks an element of the TreeView control.
Attention: When double-clicking on an element, the click code is executed, followed by the double-click code.
Enter a row in inputExecuted when the user selects a row to perform an input in this row.
Caution: This code is only available if the TreeView control field is enabled.
Row exitExecuted when moving from one row or control to another (TAB key, selecting another control with the mouse, etc.).
Caution: This code is only available if the TreeView control field is enabled.
Row displayExecuted when a new row must be displayed in the TreeView control.
Selecting a rowExecuted when a new element is selected in the TreeView control.
Right clickExecuted when the user performs a right click on the TreeView control (or on one of its elements).
Double clickExecuted when the user performs a double click on the TreeView control (or on one of its elements).
Collapsing/Expanding a nodeExecuted 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.

Attention: When clicked or double-clicked, this event is executed with the "Click" event.. This event is run before the desired action is performed.

Note: This event can accept parameters (see below).
Filtering records
(optional event)
Event taken into account for TreeView controls based on a data file 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 "Initialization" event of each control is executed according to the order in which the controls were created in the window. To modify this runtime order:
  1. On the "Window" tab, in the "Order" group, click "Initialization".
  2. In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
WEBDEV - Server codeWEBDEV - Browser codeAjax

Events supported in WEBDEV

The following events appear by default in the WEBDEV code editor:
EventRuntime condition
InitializationExecuted 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: Winding/unwinding a knot
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.
Warning: 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 "Collapsing/Expanding a node" event.
The procedure must be declared with the following syntax:
PROCEDURE <Nom de la procédure>([<Chemin de l'élément> [, <Enroulé> [, <Identifiant> ]]])
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 "Collapsing/Expanding a node" event
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.
    Note: Several optional events can be selected.
  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.
Note: If the deactivated 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, double click,
  • right mouse button down, up, double click,
  • the mouse wheel.
Filtering records (TreeView control based on a data file 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 "Filter records" event 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: 09/21/2024

Send a report | Local help