- Overview
- How to create a Container column in a Table control?
- Steps to follow
- Main control of a Container column
- Limitations
- Using a Container column
- Table control based on a data file or Table control based on a variable
- Table control populated programmatically
- Handling the controls found in the Container column
- Limit: Unavailable control types
Container column in a Table control
A table cell can contain a set of controls. Several types of controls can be include in a Container column: - Static control,
- edit control,
- Image control,
- Button control,
Chart control, Table control, Internal Window control, - ...
A main control can be defined for the cell. This control will be the one used: - for the additions performed through programming,
- for the sorts,
- for the link with the data (link with an item or with a variable), ...
How to create a Container column in a Table control? Steps to follow To create a Container column in a Table control: - If necessary, create a Table control (based on a data file, populated programmatically or based on a variable).
- Create a Container column (via the popup menu of the Table control or from the description window of the Table control).
- Increase (if necessary) the height of the rows found in the Table control with the mouse.
- Position the requested controls in the Container cell of the first row found in the Table control. You can:
- move the existing controls in the window to the Container column.
- drag and drop the items from the analysis displayed in the "Project explorer" pane.
- In the description of the Container column, specify (if necessary) the main control of the column ("General" tab) and validate.
Main control of a Container column The main control of the Container column corresponds to the control handled by default in the column. For example: - The sort of the Container column will be performed on the main control.
- The searches performed in a Container column will be performed on the main control.
- The additions, the modifications, ... performed through programming: the value of the column specified in TableAddLine for example will be assigned to the main control.
- The exports performed from the Table control (exports to Excel, Open Office, Word, ...) will take into account the value of the main control of the column.
- If the Container column is linked to a data file or to a variable, the control actually linked will be the main control.
The definition of a main control in a Container column is optional. Limitations In the Container columns, the Check Box controls must be assigned with a string in the following format: "<True/False>;<True/False>;<True/False>...". Similarly, the value returned by these Check Box controls is a string in the following format: "<True/False>;<True/False>;<True/False>...". - The captions of the options found in the Radio Button and Check Box controls cannot be customized for each row in a Container column.
To use a control with a different value for each row found in a Container column, all you have to do is include this control in an internal window and insert an Internal Window control into the column. This tip can be used for the Radio Button and Check Box controls for example, ...
Table control based on a data file or Table control based on a variable A Table control based on a data file can contain one or more Container columns. The controls found in this Container column can display the records of the data file for example. In this case, the Table control is linked to the data file. Each control found in the Container column is linked to the corresponding item. If a main control is defined on the Table control, we advise you to: - solution 1: keep the link between the main control and the item found in the data file. The Container column is linked to no item.
- solution 2: link the Container column to the item associated with the main control and delete the link at control level.
Related Examples:
|
Discovery examples (WINDEV): WD Discover Database Link
[ + ] This example is a simplified application for managing contacts. This example explains how to: - fill a Table control from a data file, - fill a Looper control from an SQL query, - create a form.
|
Table control populated programmatically A Table control populated programmatically can contain one or more Container columns. The main control of the Container column will be handled programmatically by the Table control functions For example, when a row is added by TableAddLine, only the main control of the column will be assigned with the value defined by the column. If several controls must be initialized in the column, you must use the syntax described in the next paragraph. For example:
RowNum is int RowNum = TableAddLine(TABLE_Table2, "Moore") COL_Column1[RowNum].EDT_FirstName = "Flora"
Handling the controls found in the Container column The controls found in a Container column can be handled via the following syntax:
<Column name>[<Row number>].<Control name>
For example: - Assigning a value to a control:
COL_Column1[RowNum].EDT_FirstName = "Flora"
- Assigning elements to a Combo Box control of a container:
COL_Column1[RowNum].COMBO_Combo1.Content = "Element 1" + CR + "Element 2"
- Modifying a control property:
COL_Column1[RowNum].PriceBT.Color = LightRed
- Indirection on a control in a Container column:
sControlNameInContainerColumn is string sControlNameInContainerColumn = "TABLE_WithContainerCol.COL_Container[" + ... nRowIndex + "].EDT_InContainerCol" //or //sControlNameInContainerColumn = "TABLE_WithContainerCol[" + ... // nRowIndex + "].COL_Container.EDT_InContainerCol" Info({sControlNameInContainerColumn})
Adding a row into a Table control found in a Container column:
TableAddLine(TABLE_WITH_INTEGRATED_TABLE[RowNum].TABLE_In_Container, ... "Content_Col1", "Content_Col2")
Handling a Check Box control inserted into an internal window:
TABLE_NoName1[RowNum].IW_NoName1.CBOX_CheckBox[Index] = True
Change the internal window in an Internal Window control of a Container column:
// Load the internal window IW_Internal Window1, on the row RowNum of an Internal Window control // named IWC_InternalWindowControl in a container column of a Table control // Caution: the IWC_InternalWindowControl control must have // the option "Identical content for all the rows" unchecked // ("UI" tab of the description window) ChangeSourceWindow(TABLE_NoName1[RowNum].IWC_InternalWindowControl, IW_InternalWindow1)
Remark: For a Table control based on a data file, the controls of a Container column should be handled in the event "Row display". Limit: Unavailable control types
This page is also available for…
|
|
|