The Table Objects: 3.2 TableClass Instance Data: Defining Columns

Up: GEOS SDK TechDocs| Up | Prev: 3.1 Table Attributes | Next: 3.3 Working with Rows
TableColumnDefinition, TableColumnFlags, TableRangeInversionType, MSG_GEN_TABLE_GET_COLUMN_COUNT

When you create a Table object, you must specify what columns the Table has. Typically, each column will represent a different kind of data, and can be of a different length. When you define a Table object, you specify how many columns the table will have; this number is fixed for the table, and cannot be changed later. (It is possible to have your Table switch the column definitions that they use, although it will take a fair amount of work on your part; that is discussed in Changing Column Definitions.) You can find out how many columns a table has by sending it MSG_TABLE_GET_COLUMN_COUNT .

Each column has its own definition--stored in the Table's TI_ columnDefinitions array--specified by a TableColumnDefinition structure that cannot be changed later. This structure has the following definition:

 typedef struct {
	TableColumnFlags			TCD_flags;
	word			TCD_width;
} TableColumnDefinition;
TCD _flags
This is a TableColumnFlags record (described on The TableColumnFlags record has the following flags: below).
TCD _width
This is the width of the column in points (72 points = 1 inch, so 28.3 points ª 1 centimeter).

The TableColumnFlags record has the following flags:

TCF_DRAW_RIGHT_SEPARATOR
If this flag is set, the column will have a solid line drawn on its right border (separating it from the next column to its right). This right-separator will not be drawn if the column is the last (right-most) column in the Table.
TCF_START_SELECT
If this flag is set, then if the user performs a "start-select" anywhere in the column, the Table object will send itself MSG_TABLE_SELECT.
TCF_END_SELECT
If this flag is set, then if the user performs an "end-select" anywhere in the column, the Table object will send itself MSG_TABLE_SELECT.
TCF_DRAG_SELECT
If this flag is set, then if the user performs a pointer drag that crosses cell boundaries within the column, or enters or leaves the column, the Table object will send itself MSG_TABLE_SELECT.
TCF_DOUBLE_SELECT
If this flag is set, then if the user double-clicks anywhere in the column, the Table object will present a VisText , allowing the user to edit the contents of the cell. (See Editing Cells.)
TCF_RESELECT
If this flag is set, then if the user performs a "start-select" in the column on a cell that is already in a range of selected cells, the Table object will send itself MSG_TABLE_SELECT.
TCF_HOLD_SELECT
If this flag is set, then if the user performs a "start-select" in the column on a cell and holds for a certain period of time, the Table will send itself MSG_TABLE_SELECT. This flag also sets the TF_INTERNAL_DRAG_DROP flag.
TCF_TRIT
This is a three-bit field. The value in this field is a member of the TableRangeInversionType enumerated type; it specifies how the Table should display selected cells in this column.

TableRangeInversionType specifies which cells should be drawn as highlighted when the user performs a selection action. Note that each column has its own TableRangeInversionType value. If a selection action crosses from one column into another, the Table uses the TableRangeInversionType of the last column the pointer was in. TableRangeInversionType has the following values:

TRIT_CELL
When the user selects a cell in this column, highlight just that cell.
TRIT_ROW
When the user selects a cell in this column, highlight the entire row containing that cell.
TRIT_COLUMN
When the user selects a cell in this column, highlight the entire visible portion of this column (i.e. every cell in this column that is (at least partially) visible on-screen).
TRIT_MULTI_ROW
Highlight the area bounded by the two cells in which the selection started and ended. The selection is made row by row as if all cells were in a single sequence with the last (right-most) cell of one row being followed by the first (left-most) cell of the next row. (One can think of this selection being analogous to a text selection across several lines.)
TRIT_RECTANGLE
Highlight all the cells in the rectangle pointed by the start-select cell and the end-select cell.
TRIT_MULTI_ROW_FULL
Highlight the row in which the user start-selects, and all rows through which the user drags the selection pointer.
TRIT_MULTI_COL_FULL
Highlight the first column in which the user start-selects, and all columns through which the user drags the selection pointer.
TRIT_NONE
This indicates that the Table should not highlight any selections.

When you create a Table , you must specify how many columns the table has, and what the characteristics of each column are. You specify the number of columns the Table has by setting TI _columns to that number. You cannot change the number of columns in the Table after the Table has been created. To find out how many columns a Table has, send it MSG_TABLE_GET_COLUMN_COUNT .

To specify the attributes of each column, you must create a chunk in the same object block as the Table . That chunk must contain an array of TableColumnDefinition structures, one for each column in the Table . The structures should be in the same order as the columns (i.e. the left-most column would be the first structure in the array).

MSG_GEN_TABLE_GET_COLUMN_COUNT

word	MSG_GEN_TABLE_GET_COLUMN_COUNT();

This message returns the number of columns in a Table object.

Source: Unrestricted.

Destination: Any Table object.

Parameters: None.

Return: The number of columns in the Table .


Up: GEOS SDK TechDocs| Up | Prev: 3.1 Table Attributes | Next: 3.3 Working with Rows