"tableMode"

Sets the table mode.

Synopsis

setValue(string shape, "tableMode", int mode);

getValue(string shape, "tableMode", int &mode);

shape.tableMode(int mode);

Parameters

Parameter Description
shape Name of the object
mode

Integer constant that sets the table selection mode:

TABLE_SELECT_NOTHING: Default setting, no lines or cells can be selected (mode=0).

TABLE_SELECT_BROWSE: Browse mode that has to be set in order to select single lines or cells from a table with the attribute selectByClick. See the example at the end of this page and the attribute selectByClick (mode=1).

TABLE_SELECT_MULTIPLE: Multiple selection mode that has to be set in order to select several lines or cells from a table simultaneously with the attribute selectByClick (mode=2).

TABLE_SELECT_TOGGLE: Allows multiple selection with touch. After enabling this mode a cell, line or column selected by tapping or clicking it stays selected until it is tapped or clicked again.

Description

Used to set the table mode. The Default is TABLE_SELECT_NOTHING.

Note:

Enabling an automatic switch between TABLE_SELECT_TOGGLE for touch screens and TABLE_SELECT_MULTIPLE when no touch screen is available, can be done with the following code:

TABLE1.tableMode = usesTouchScreen() ? TABLE_SELECT_TOGGLE : TABLE_SELECT_MULTIPLE; 

Example

The following example switches the table to a mode that allows selecting single lines by clicking on them. In order to be able to select lines, you have to add lines with the attribute "appendLine" first (see also the attribute appendLine). Lines in the table exist only when they have been added with the attribute "appendLine". Thereafter you have to set the selection mode to "TABLE_SELECT_BROWSE" for selecting lines with the "selectByClick" attribute. You have to create "Table1" and this table has to contain the columns "Name" and "Last name" for the example to function.

main()
{
  Table1.appendLine("Name","Matt", "Last name","Davis");
  /*Add the line Matt Davis. "Name" and "Last name" are the names of the table columns */
  Table1.appendLine("Name","Karin","Last name","Meyer");
  Table1.tableMode(TABLE_SELECT_BROWSE); 
  /* Set the table mode TABLE_SELECT_BROWSE so that single lines can be selected via the attribute "selectByClick"*/
  Table1.selectByClick(TABLE_SELECT_LINE);
  /* Single lines can be selected via the constant TABLE_SELECT_LINE of the selectByClick attribute. 
  You can also use other constants of the selectByClick attribute in order to select e.g. only cells. 
  See the attribute selectByClick */
}

Example

This example shows how several lines can be selected from a table simultaneously. This example is similar to the previous one with the exception that several lines will be added to the table and a different table mode "TABLE_SELECT_MULTIPLE" will be set.

main()
{
  Table1.appendLine("Name","Linda","Last name", "Davis");//Add lines
  Table1.appendLine("Name","John", "Last name", "Hill");
  Table1.appendLine("Name","Carol", "Last name","Garcia");
  Table1.appendLine("Name","Matt", "Last name","Lorek");
  Table1.tableMode(TABLE_SELECT_MULTIPLE);/*Set the table mode TABLE_SELECT_MULTIPLE so that several lines can be selected simultaneously via selectByClick */
  Table1.selectByClick(TABLE_SELECT_LINE);//Selects lines
}

Assignment

Table