Attributes and controls of a browsing Looper control in WEBDEV
A Looper control includes:
- controls, that are repeated on each row.
- attributes. An attribute is used to define the control characteristic that will be modified on each row. For example, if the value and the color of PRICE control must change on each row, you will have to define two different attributes for the same control.
When creating a browsing Looper control, a control and an attribute are automatically created for each item found in the data file or in the query.
This attribute corresponds to the association between the control linked to the item of the data source (data file or query) and the change of control value on each row.
To modify one or more characteristics of these controls (color, status, width, height, ...), you must:
- add new attributes ("New" or "Insert" button in the control description).
- handle these attributes by programming in the event "Displaying a row" of the Looper control.
For example, the Looper control "LOOP_MyLooper" is based on the data file "Customer". This data file contains 10 items (name, address, phone number, ... of each customer). When creating the Looper control, 10 controls and 10 attributes will be automatically created:
- Each control will be linked to an item of data file "Customer".
- Each attribute will indicate the characteristic that must be modified on each row: the value of the control.
In order for the background color of the "EDT_CustomerName" control to change on each row, you must:
- add a new attribute ("ATT_ColorAttribute" for example). This attribute will be associated with the "EDT_CustomerName" control and it will have the "Background color" property.
- handle this attribute by programming to define the requested background color. For example:
// -- Displaying a row of LOOP_MyLooper
Subscript is int
// Retrieve the subscript of the current row
Subscript = LOOP_MyLooper
IF IsEven(Subscript) = True THEN
// The background color will be red for the even rows
ATT_ColorAttribute[Subscript] = LightRed
// The background color will be blue for the the odd rows
ATT_ColorAttribute[Subscript] = LightBlue
Note: When creating a browsing Looper control, a pager is automatically associated with the Looper control. This pager is used to display the records found in the Looper control.