|
|
|
|
|
- Overview
- How to?
- Including a Table control in a Looper control
- Including a control in a Looper control
- Accessing the contents of internal window fields from the host window
Displaying a different content on each row
In a Looper control, a different content can be assigned to the Table, Chart, List Box and TreeView controls: - If the control to repeat is a Table control or a Chart control, all you have to do is insert it into the Looper control directly.
- If the control to repeat is another type of control (List Box control, TreeView control, etc.), simply insert this control into an internal window. Then, all you have to do is create the associated Internal Window control in the Looper control.
Remark: The Table and Chart controls or the controls in the internal window must be populated programmatically. Including a Table control in a Looper control To include a Table control in a Looper control: - If necessary, create a Looper control: based on a data file, based on a variable, or populated programmatically.
- Insert the Table control into the Looper control. The Table control must be populated programmatically.
- Make sure that "Identical content for all the rows" is unchecked ("UI" tab in the description window of the Table control).
- The Table control can now be populated programmatically.
The Table control found in the Looper control can be filled by using TableAddLine according to the following method: TableAjouteLigne(<Nom du champ Zone répétée>[Indice de la répétition].<Nom du champ Table>, <Elément colonne 1>, <Elément colonne 2>, ...) Example: The following code is used to populate the content of the Table control found in the Looper control. The Looper control lists the orders and the Table control lists the products ordered. The following code is used to fill both the Looper control and the Table control: PROCEDURE RemplirCommandesDuJour()
nIndice is int
LooperDeleteAll(ZR_CommandesDuJour)
FOR EACH Commande where "DateCommande = '" + Today() + "' AND EstFinalisée = 0"
HReadSeekFirst(ContactClient, IDContactClient, Commande.IDContactClient)
IF HFound(ContactClient) = False THEN CONTINUE
nIndice = LooperAddLine(ZR_CommandesDuJour, Commande.IDCommande, ...
ContactClient.Societe, ContactClient.Nom + ...
[" "] + ContactClient.Prénom)
FOR EACH LigneCde where IDCommande = Commande.IDCommande
HReadSeekFirst(Produit, IDProduit, LigneCde.IDProduit)
IF HFound(Produit) = False THEN CONTINUE
TableAddLine(ZR_CommandesDuJour[nIndice].TABLE_Commande, ...
Produit.IDProduit, Produit.Libellé, LigneCde.Quantité)
END
END
To get an easier syntax, the fill operation can be directly performed in the code for displaying a row of Looper control. In this case, there is no need to specify the index of the main looper. The syntax becomes: TableAjouteLigne(<Nom du champ Table>, <Elément colonne 1>, <Elément colonne 2>, ...) Tip: Don't forget to clear the Table control in the display code of a row of the Looper control, before it is populated by TableDeleteAll. Including a control in a Looper control To integrate another control (List Box, TreeView, etc.) into the Looper control: - If necessary, create a Looper control: based on a data file, based on a variable, or populated programmatically.
- Insert an Internal Window control into the Looper control.
- Make sure that "Identical content for all the rows" is unchecked ("UI" tab in the description of the Internal Window control).
- Create an internal window if necessary. Insert the control (Chart, List Box, TreeView, etc.) into this internal window. The inserted control must be populated programmatically.
- Associate the Internal Window control with the internal window ("General" tab in the description of Internal Window control).
- The control can now be populated programmatically.
For example, TreeAdd can be used as follows in order to fill a TreeView control found in a Looper control: ArbreAjoute(<Nom du champ Zone répétée>[Indice de la répétition]. <Nom de la fenêtre interne>.<Nom du champ Arbre>, <Elément à ajouter>) Accessing the contents of internal window fields from the host window To access the contents of the control s of the internal window from the host window, simply handle the desired repetition, the internal window and then the control. Example: Retrieve the value of an edit control of type date from the first occurrence of Looper control: x est Champ <- ZR_SansNom1[1] Trace(x.FI_SansNom1.SAI_DATE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|