6. Working with Arrays, Table Fields, and Collections : Table Field Operations : Column Operations : How You Can Turn CellAttributes On
 
Share this page                  
How You Can Turn CellAttributes On
The CellAttribute object gives you access to the attributes of an individual cell in a table field column. Because of the impact on performance, OpenROAD does not automatically create CellAttribute objects when you create a table field. Instead, if you want to use CellAttribute objects, you must explicitly or implicitly turn them on.
CellAttribute objects are turned on by column rather than on a cell-by-cell basis. Turning on CellAttributes for a column sets it on for all cells in that column.
The easiest way to turn on CellAttributes for a column is to use the Property Inspector to set the column's HasCellAttributes attribute to TRUE. This involves the least performance overhead. However, you can choose to turn CellAttributes on at runtime by using one of the following techniques:
Explicitly, in the initialize portion of a frame script
To turn on the CellAttributes explicitly, set the HasCellAttributes attribute of the ColumnField object to TRUE. The syntax is:
field(tablefield[*].column).HasCellAttributes = TRUE
Implicitly, by referencing one of the CellAttribute's attributes in your script
If they are not already on, the CellAttributes are implicitly turned on when your script sets a cell attribute for a cell. For example, the following event block changes a cell's background color to red when a user tabs into a column. The first time the user enters the specified column, the cell attributes are turned on for that column.
on childentry custtable[*].custname =
begin
    field(custtable[].custname).bgcolor = CC_RED;
end;
Setting CellAttributes implicitly has the advantage of creating CellAttributes only when needed. You cannot turn on CellAttributes for the cells of a nested table field.