"currentCell"

Sets or reads the column number and row number of an active cell. The property also returns the column and row indexes of a table when programmed as RightMousePressed event.

Synopsis

setValue(string shape, "currentCell", int n, int k);

getValue(string shape, "currentCell", int &n, int &k);

shape.currentCell(int n, int k);

Parameters

Parameter Description
shape Name of the object
n Line
k Column

Description

Returns (only with getValue()!) or sets the row number (n) and column number (k) of an active cell. Remember that the index of the row respectively column starts with 0.

You have to select a row or cell. If you do not select anything, the function returns -1.

Example

main()
{
  int n, k;
  // Reads the current position
  getValue(table, "currentCell", n, k);
  // Sets a new position
  table.currentCell(1, 3);
}

Example

The example obtains the indexes of the rows and columns of a table when you right-click on the table. Rows exist in a table only after you have added them with the appendLine function. If you create a table in the GEDI and add rows through the editor, the rows do not exist as yet. You have to add them with the appendLine function.

This means that if you have a table and you have added rows with the editor, you cannot obtain the row indexes by using the currentCellproperty. You obtain the row indexes after you have added rows with theappendLine function and then use the currentCellproperty.

This example shows how to add rows into a table with the appendLine function and how to obtain the index numbers of these rows with the currentCellproperty.

The first code example shows how to add lines into "Table1" with a column "name". The code adds the names "Matt", "Claudia" and "John" as new lines into the "name" column. Add this code, for example,. to the initialize event in the editor.

main()
{
  Table1.appendLine("name", "Matt");
  Table1.appendLine("name", "Claudia");
  Table1.appendLine("name", "John");
} 

The next code example shows how to obtain the row and column indexes of a table with "currentCell". This code has to be programmed as RightMousePressed event and you obtain the indexes then by right-clicking on the table.

main()
{
  int col1;
  int row1;
  shape table=getShape("Table1");
  getValue(table, "currentCell", row1, col1);
  DebugN("Row ",row1, " ","Column",col1);
} 

Assignment

Table