ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Looper control
  • Default events
  • Events supported in WEBDEV
  • Filter records (Looper based on a data file only)
  • Click on a Looper control (browser code only)
  • Optional events
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 Looper controls
Default events
WEBDEV - Server codePHP

Events supported in WEBDEV

The following events appear by default in the WEBDEV code editor:
EventRuntime condition
Initialization (Server code)Executed when the page is opened.
Special case: Looper populated automatically based on a data file:
When this code is run, the Looper control is not filled yet. To force the Looper control to be filled in this code, use:
End of initialization (Server code)Code only for Looper controls populated automatically based on a data file:
Run once the Looper control has been filled. This code can be used to add or modify an element of the Looper control.
Row display (Server code)Executed when a new row must be displayed in the Looper control: redisplaying the Looper control, etc
Used to manage calculated attributes.
Filter records (Server code)Code only for Looper controls populated automatically based on a data file:
Run just before displaying a row. This event filters the records displayed in the Looper control. This event is detailed at the end of this page.

Remark: In a static page, only optional events are available.
Filter records (Looper based on a data file only)
WEBDEV - Server codePHP The event "Filtering the records" is run right after a row of the Looper control is displayed. Therefore, it is run:
  • when initializing the Looper control.
  • whenever a row is displayed in the Looper control.
This event filters the records displayed in the Looper 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 Looper control (very rare case).
Example:
// -- Filter records --
// Displays the customers who placed orders exceeding 3000 Euros
IF Order.TotalIOT >= 3000 THEN 
RETURN True
ELSE
RESULT False
END
In this code, the data handled affects the record currently read by the Looper control. This data comes from the data file or query linked to the Looper control.
Remark: In WINDEV and WINDEV Mobile, the "Filter records" event is optional. In WEBDEV, this event is proposed by default.
Click on a Looper control (browser code only)
The "Click on the Looper control" event is executed when the user clicks on a row of the Looper control. This process is used to select the row. This event returns the values of the attributes corresponding to the row. For example, the following click code is used to find out the value of the ATT_Title attribute for the row that was clicked:
Trace(ATT_Title)
Optional events
Several optional events can be added. 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.
For example, you can use the following events:
  • left mouse button down, up, double click,
  • right button down, up, etc.
For more details, see the Optional events.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/01/2024

Send a report | Local help