PC SOFT

WINDEV的在线文档

  • Overview
  • Selecting, adding and modifying a row in a Table control
  • Deleting a row from a Browsing Table control
  • Managing the calculated columns
  • Retrieving the content of a row, column or cell
  • Important
  • Value of a cell in the current row
  • Value of a cell in a specific row
  • Content of the current row
  • Content of row X
  • Content of the selected rows for a multi-selection
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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本地访问

Programming the browsing Table controls

Overview
The main concepts for programming the browsing Table controls are as follows. Several WLanguage functions allow you to manage Browsing Table controls by programming.

Do not hesitate to see the documentation about these functions. For more details, see: List of functions for managing the Table controls.

Selecting, adding and modifying a row in a Table control
The selection of a row is performed by 表格选择行.

If no stored item is defined for the Table control, you also have the ability to use the following syntax:

<Table Name> = <Number of Row to Select>

Adding and modifying a row in the Table control (and a record in the file) is performed in two steps:
  1. Adding or modifying the record in the file (via a form window or page for example)
  2. Redisplaying the Browsing Table control:
    • WinDev refreshing the Table control.

Deleting a row from a Browsing Table control
To delete a row from a Table control, use 表格删除. 表格删除 deletes the corresponding record from the data file.

Important: To delete a record from the data file, don't use H删除 otherwise you may lose data.

Managing the calculated columns
The calculation formula of a calculated column must be described in the "Displaying a table row" process.

Example of "Displaying a table row" process:

// COL_AlertMsg: a calculated column
// The COL_AlertMsg column displays "Alert" if COL_Stock<200
如果COL_Stock小于200,那么
COL_AlertMsg"Alert"
否则
COL_AlertMsg""
结束

By definition, a calculated column is not linked to an item: the value assigned by the display code of a row is not stored after a scroll.

For example, a FOR EACH LINE statement cannot be used to assign or retrieve the value of a calculated column for all the rows of the Table control.

If the Table control is a memory Table control ("Loaded in memory" checked in the "Content" tab of the description window of the control), the calculated columns can be stored at run time.

Retrieving the content of a row, column or cell

Important

The content of a row found in a browsing Table control can be retrieved:
  • by retrieving the entire row.
  • cell by cell.

Value of a cell in the current row

The cell is identified by the name of the column. The following syntax must be used:

<Value> = <Column Name>

// COL_QTY is a column of the Table control
如果COL_QTY小于10,那么
信息"Insufficient quantity"
结束

Value of a cell in a specific row

The cell is identified by the name of the column. The following syntax must be used:

<Value> = <Column Name>[<Row Subscript>]

Example:

// Adds the price found in the COL_PBT column  
// for all the order lines displayed
TotalPrice0
对于Subscript1直到TABLE_ORDERS..数目
TotalPriceTotalPrice+COL_PBTSubscript
结束

Content of the current row

The following syntax must be used:
<Value> = <Name of Table Control>

You also have the ability to use the following syntax:
<Value> = <Name of Table Control>[Name of Table Control>]

Content of row X

The following syntax must be used:

<Value>=<Name of Table Control>[<Row Subscript>]

Note: The subscript of the row can be returned by 表格选定行.

// Retrieves the current row of TABLE_CUSTOMER control
CurrentRowTABLE_CUSTOMER

// Name of selected customer
CustNameCOL_NAME表格选定行TABLE_CUSTOMER)】

Content of the selected rows for a multi-selection

The following syntax must be used:
<Value>=<Name of Table Control>[<Row Subscript>]

Note: To find out the subscript of the selected rows, you must use 表格选定元素数目 and 表格选定行.

// Traces the content of selected rows
i整数型
NbSelected整数型表格选定元素数目TABLE_Product
对于i1直到NbSelected
跟踪"Selected row: "+...
TABLE_Product表格选定行TABLE_Producti)】)
结束

// Equivalent to:
// FOR EACH SELECTED ROW OF TABLE_Product
// Trace("Selected row: " + ...
// TABLE_Product[表格选定行(Product,i)])
// END

Note: The multi-selection browsing Table controls are not available:
  • If the Table control contains proportional scrollbars.
  • If the Table control is a "5.5 compatible" type control.
  • In Table controls displayed by combo boxes.
Note: ..多重选择 is used to find out the selection mode of a Table control.