PC SOFT

WINDEV的在线文档

  • Overview
  • How to proceed?
  • Including a Table control in a Looper control
  • Including a control in a Looper control
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

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 表格添加行 according to the following method:
表格添加行(<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:

过程FillOrdersOfTheDay()

// Local variables
nSubscript整数型

// Clears the Looper control
重复区域删除全部LOOP_OrdersOfTheDay

// Browse the orders of the day
对于每个Order满足"OrderDate = '"+今天()+"' AND IsFinalized = 0"

// Finds the associated contact
H读查找第一个CustomerContactCustomerContactIDOrder.CustomerContactID
如果H找到CustomerContact)=,那么继续

// Adds a row into the Looper control
nSubscript重复区域添加行LOOP_OrdersOfTheDayOrder.OrderID,...
CustomerContact.CompanyCustomerContact.LastName+...
" "】+CustomerContact.FirstName

// Browses the order lines
对于每个OrdLine满足OrderID等于Order.OrderID
H读查找第一个ProductProductIDOrdLine.ProductID
如果H找到Product)=,那么继续

// Add the ordered elements into the Table control
表格添加行LOOP_OrdersOfTheDaynSubscript】.TABLE_Order,...
Product.ProductIDProduct.CaptionOrdLine.Quantity
结束
结束

To get an easier syntax, the fill operation can be directly performed in the code for displaying a row of the Looper control. In this case, there is no need to specify the subscript of the main looper. The syntax becomes:
表格添加行(<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 表格删除全部.

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 the Internal Window control).
  6. The control can now be filled by programming.
For example, 树视图添加 can be used as follows in order to fill a TreeView control found in a Looper control:
树视图添加(<Name of Looper Control>[Row Subscript].
<Name of Internal Window>.<Name of TreeView Control>, <Element to Add>)