PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • Including a Table control in a Looper control
  • Including a control in a Looper control
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
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, ...), all you have to do is insert this control into an internal window. Then, all you have to do is create the associated Internal Window control in the Looper control.
Note: The Table controls, the Chart controls or the controls of the internal window must be filled by programming.
How to proceed?

Including a Table control in a Looper control

To include a Table control in a Looper control:
  1. Create a Looper control if necessary (browsing looper, memory looper or looper on source).
  2. Insert the Table control into the Looper control. The Table control must be filled by programming.
  3. Make sure that "Identical content for all the rows" is unchecked ("GUI" tab in the description window of the Table control).
  4. The Table control can now be filled by programming.
The Table control found in the Looper control can be filled by using TableAddLine according to the following method:
TableAddLine(<Name of Looper Control>[Row Subscript].<Name of Table Control>,
<Element Column 1>, <Element Column 2>, ...)
Example: The following code is used to fill 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 FillOrdersOfTheDay()

// Local variables
nSubscript is int

// Clears the Looper control
LooperDeleteAll(LOOP_OrdersOfTheDay)

// Browse the orders of the day
FOR EACH Order WITH "OrderDate = '"+Today() + "' AND IsFinalized = 0"

// Finds the associated contact
HReadSeekFirst(CustomerContact, CustomerContactID, Order.CustomerContactID)
IF HFound(CustomerContact) = False THEN CONTINUE

// Adds a row into the Looper control
nSubscript = LooperAddLine(LOOP_OrdersOfTheDay, Order.OrderID, ...
CustomerContact.Company, CustomerContact.LastName + ...
[" "] + CustomerContact.FirstName)

// Browses the order lines
FOR EACH OrdLine WITH OrderID = Order.OrderID
HReadSeekFirst(Product, ProductID, OrdLine.ProductID)
IF HFound(Product) = False THEN CONTINUE

// Add the ordered elements into the Table control
TableAddLine(LOOP_OrdersOfTheDay[nSubscript].TABLE_Order, ...
Product.ProductID, Product.Caption, OrdLine.Quantity)
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 subscript of the main looper. The syntax becomes:
TableAddLine(<Name of Table control>, <Element column 1>, <Element column 2>, ...)
Tip: In the display code of a row of the Looper control, don't forget to clear the Table control before it is filled by TableDeleteAll.

Including a control in a Looper control

To include another control (list box, treeview, ...) in the Looper control:
  1. Create a Looper control if necessary (browsing looper, memory looper or looper on source).
  2. Insert an Internal Window control into the Looper control.
  3. Make sure that "Identical content for all the rows" is unchecked ("GUI" tab in the description of the Internal Window control).
  4. Create an internal window if necessary. Insert the control (chart, list box, treeview, ...) into this internal window. The inserted control must be filled by programming.
  5. Associate the Internal Window control with the internal window ("General" tab in the description of Internal Window control).
  6. The control can now be filled by programming.
For example, TreeAdd can be used as follows in order to fill a TreeView control found in a Looper control:
TreeAdd(<Name of Looper Control>[Row Subscript].
<Name of Internal Window>.<Name of TreeView Control>, <Element to Add>)
Minimum required version
  • Version 16
Comments
Click [Add] to post a comment