- Default events
- Optional events
- Filter records (Table based on a data file only)
- Before displaying the automatic tooltip of scrollbar
Events associated with Table controls
and WINDEV Mobile
manage the following events by default (order of appearance in the code editor):
|Initialization||Executed when the window is opened. (*)|
Special case: Table control based on a data file filled automatically
When this code is run, the Table control is not filled yet. To force the Table control to be filled in this code, use:
You can also filter records with HFilter
|End of initialization||Code only for automatically populated Table controls based on a data file:|
Executed after the Table control has been populated. This code is used to select an element in the Table control, to add or modify an element.
|Entry in the Table control||Executed when the control gains focus.|
|Exit from the Table control||Executed when moving from one control to another (TAB key, selecting another control with the mouse, etc.).|
|Entry in edit in a row of the Table control||Run when the user selects a row to perform an input in this row.|
|Exit from a row of the Table control||Run when moving from one row or control to another (TAB key, selecting another control with the mouse, etc.). The Table control must be in edit. |
In this code, the current row corresponds to the row that was selected beforehand.
- control Table with switch column: simply modifying the check box does not run the row exit code. If a user clicks a check box column, WINDEV does not consider this as entering the row in edit mode . The "Entry in input in a row" and "Exit from a row" events are not executed. To manage this case, it is recommended to use the column modification code.
- control Display table: this code is not executed when row changes to Table control in display.
In this code, the current row corresponds to the new selected row.
|Displaying a row of the Table control||Run when a new row must be displayed in the Table control: redisplaying the Table control, scrolling or moving in the Table control, etc, ...|
This event is also run when column is assigned. If several columns are assigned through programming, the display code will be run several times.
Tip: To modify several columns, use TableModifyLine rather than the direct assignment.
|Selecting a row of the Table control||Run when the user selects a row (without input).|
This event is also run when the user clicks a cell whose selection mode is set to "Single selection" or: Multi-selection".
|This event is automatically added when the "Pull to refresh" feature is enabled ("Details" tab in the description window of the Table control). |
This event is run when a refresh gesture is detected on the Table control.
At the end of this event, the refresh bar will be automatically hidden except if TableRefreshVisible
has been called.
Filter records (optional event)
|Code only for automatically populated Table controls based on a data file:|
Run just before displaying a row. This event filters the records displayed in the Table control. This event is detailed at the end of this page.
Drag and Drop management events (optional events)
|Code only for Table controls populated programmatically and Table controls based on a variable: |
These events are used to simplify the management of programmed Drag and Drops. The available events are:
Remark: If one of these events contains some code, the Drag and Drop feature is not automatically managed for Table controls: the Drag and Drop in the Table control must be managed through programming
- Beginning of source drag/drop.
- End of source drag/drop.
- Entry in target drag/drop.
- Rollover in target drag/drop.
- Drop in target drag/drop.
- Exit from target drag/drop.
|Scrolling events (optional events)||These events make it easy to manage the vertical scrollbar in the control. The available events are:|
- Start scrolling: Executed when the vertical scrollbar of the control starts moving.
- While scrolling: Executed while the vertical scrollbar of the control moves.
- Stop scrolling: Executed when the vertical scrollbar of the control stops moving.
(*) By default, the "Initialization" event of each control is executed according to the order in which the controls were created in the window. To change this order of execution:
- On the "Window" tab, in the "Order" group, click "Initialization".
- In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
Several optional events are supported.
To add an optional event:
- Select the desired control.
- Display the code window of this control (F2 key).
- Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
- All the optional events available for the control are displayed.
- Check the optional event to add and validate.
Remark: You can select several optional events.
- 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 the following aspects, for example:
- the mouse hover over the control,
- left mouse button down, up, double click,
- right mouse button down, up, double click,
- mouse wheel, etc.
Remark: The optional events differ according to the environment (WINDEV, WEBDEV, WINDEV Mobile) and the development platform.
Filter records (Table based on a data file only)
The "Filter records" event is executed after a row of the Table control is displayed. Therefore, it is run:
- when initializing the Table control.
- whenever a row is displayed in the Table control.
This event filters the records displayed in the Table 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 table (very rare case).
// -- Filtrage des enregistrements
// Affiche uniquement les clients dont commandes sont supérieures à 3000 euros
IF Commande.TotalTTC >=3000 THEN
In this code, the data used affects the record currently read by the Table control. This data comes from the data file or query linked to the Table control.
If an automatic filter is applied on the Table control (TableEnableFilter
or filter enabled by the user directly), the filter defined by the "Filter records" event is combined with the automatic filter.
Remark: In WINDEV and WINDEV Mobile, the "Recording the records" event is an optional event. In WEBDEV, this event is proposed by default.
Before displaying the automatic tooltip of scrollbar
In Windows, the tooltip for the scrollbar in a Table control is displayed when the user clicks the "box" of the vertical scrollbar.
This tooltip contains the following information by default:
- Range of rows currently displayed in the Table control.
- Total number of rows in the Table control.
- Information about the element currently displayed in the first row of the Table control in the sorted column.
The event "Before displaying the automatic tooltip of the scrollbar" is run just before the tooltip is displayed. This allows displaying a specific text in the tooltip using the Bulle
property, for example.
This page is also available for…