Attributes and controls of a Looper control based on a data file in WINDEV or WINDEV Mobile
A Looper control includes controls that are repeated on each row.
For new Looper controls based on a data file, a control is created for each item from the data file or query.
To modify one or more characteristics of these controls (color, state, width, height,...), simply handle them through programming in the "Display a row" event of the Looper control.
For example, the Looper control named "LOOP_MyLooper" is based on "Customer" file. This data file contains 10 items (name, address and phone number of each customer for example). When creating the Looper control, 10 controls will be automatically created: each control will be linked to an item of data file "Customer".
To get a different background color for "EDT_CustomerName" on each row, simply handle this control through programming to set the desired background color. For example:
// -- Displaying a row of LOOP_MyLooper
Index is int
// Retrieve the index of the current row
Index = LOOP_MyLooper
IF IsEven(Index) = True THEN
// The background color will be red for the even rows
LOOP_MyLooper[Index].EDT_CustomerName.BackgroundColor = LightRed
// The background color will be blue for the odd rows
LOOP_MyLooper[Index].EDT_CustomerName.BackgroundColor = LightBlue
Remark: For compatibility with WEBDEV, you also have the ability to use the attributes.