ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Table control
  • Overview
  • Initial state of the Table control
  • Display options
  • Selection mode
  • Column display options
  • Scrollbars in a Table control
  • Options kept for backward compatibility with the earlier versions
  • Forcing the title to be single-line
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
Table controls allow you to display and/or enter data. This data can be retrieved from a data source, a WLanguage variable or be defined programmatically.
This help page presents the main characteristics that can be defined for a Table control in a window:
You can also define the data source displayed in the control. For more details, see Content of the Table control.
Initial state of the Table control
The initial state of a Table control can be as follows:
Initial state of the Table control
This initial state can be defined when creating the control and be changed at any time in the "UI" tab of the Table control description window.
The different options are as follows:
  • Visible: The Table control can be visible. This option can be modified using the Visible property.
  • Editable: Users will be able to enter data in the different columns of the control if they are in edit mode.
    iPhone/iPad The Table control is not available in edit mode. It is available in read-only.
  • Selection (non-editable): Users will not be able to enter data in the columns of the control. However, they can select rows in the control:
    • by clicking the desired row.
    • by calling the TableSelectPlus function.
      The row will be selected with the selection bar.
      Remark: The value of the Table control corresponds to the selected row. The row selection code is executed each time a row is selected.
  • No edit, no selection: Users will not be able to enter data in the columns of the control. A row can only be selected using TableSelectPlus. This row will be selected with the selection bar. The user will not be able to change the position of the selection bar.
    Remark: The value of the Table control corresponds to the selected row.
    Tip: This option is recommended to highlight a row with the selection bar.
  • Grayed: The Table control and its columns will be grayed out. The user will not be able to enter data in the control.
Display options

Selection mode

The selection modes define how the different elements of the Table control (rows, columns, cells, etc.) can be selected by the user or programmatically. The selection mode is defined when creating the control. It can be modified at any time in the "UI" tab of the Table control description window.
The available selection modes are as follows:
Selection modes
  • No selection: No selection bar will be displayed, however the selected row, column or cell will have focus (it will be bordered by dots). A row, column or cell can be selected by clicking on it or programmatically.
  • Single selection: The selected row, column or cell will be displayed behind the selection bar. A row, column or cell can be selected by clicking on it or programmatically.
  • Multi-selection: Several rows, columns or cells of the Table control can be selected at the same time:
    • with the Shift key if the rows, columns or cells are consecutive or with the Ctrl key if they are not consecutive.
    • programmatically.
      In this case, there will be as many selection bars as there are selected elements.
Remarks:
  • A WLanguage error will occur if you try to select multiple rows programmatically and the selection mode is set to "Single selection".
  • During a multiple selection by cell, to select a row, all the cells found in the row must be selected. To make this operation easier, you can define a row selector ("Style" tab, "Row selector" element, "Selector" option, "Left arrow").
The selected elements are retrieved:
  • with the TableSelect function. You can use the tsRow, tsColumn, tsCellRow and tsCellColumn constants to retrieve information on the selected rows, columns and cells.
  • with the TableSelectCount function. You can use the tsRow, tsColumn, tsCellRow and tsCellColumn constants to retrieve the number of rows, columns and cells selected.
Example: The following example shows how to get the row and column number for the selected cells in the Table control.
// Retrieve the number of selected cells
NbSelected is int
NbSelected = TableSelectCount(TABLE_DetailedStats, tsCell)
// Loop through the selected cells
FOR i = 1 _TO_ NbSelected
// Retrieve the row and the column
nRow = TableSelect(TABLE_DetailedStats, i, tsCellRow)
nColumn = TableSelect(TABLE_DetailedStats, i, tsCellColumn)
// Process
...
END

AndroidiPhone/iPad Only the row selection mode is available.

Column display options

There are multiple options to configure the display mode of the columns. These options are available in the "Details" tab of the description window of the Table control.
Column display options
These options are as follows:
  • Remember column configuration: This option allows you to save the configuration of the columns (size, order, etc.) when the window or application is closed.
  • 'Select columns...' menu: This option enables a context menu so that the user can select which columns to show or hide in the Table control.
  • Multiline text columns: This option enables line wrapping in a column. Thus, the entire text is displayed in the cell, regardless of how long it is.
  • Maximum number of lines displayed in a row: Table control rows can contain multiple lines. This option sets the maximum number of lines a cell can display, to prevent content from spreading over too many lines, making the row unnecessarily high.
  • Number of columns fixed to the left: This option allows you to specify the number of columns fixed on the left. These columns will remain visible on the left side of the control and cannot be moved. The user will not be able to hide these columns using the horizontal scrollbar.
    The user can also freeze or unfreeze columns via the "Padlock" cursor or the "Freeze columns on the left" option in the context menu of the column title. For more details, see Freezing columns in Table controls.
    You can also freeze a column programmatically with TableFixColumn.
  • AndroidiPhone/iPad Edit column title-headers: You can define title-headers in the columns. A column title-header is an additional title displayed above the title of one or more columns. For more details, see Managing titles of columns in a Table control.
Remark: The column titles are multiline by default. The height of the header fits automatically to the number of lines. The titles of the columns support RTF.
Scrollbars in a Table control
Options kept for backward compatibility with the earlier versions

Forcing the title to be single-line

By default, the title of columns found in a Table control is multiline. The option "Force title in a singleline (8)" allows you to go back to the default behavior of version 8.
On the Table controls created with version 8 (or earlier), this option must be unchecked in order to get a multiline column title.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/07/2023

Send a report | Local help