Hi Fernando,
A book like Foster's 'Palm OS Programming Bible' might be helpful in
getting accustomed to Palm OS tables.
As far as I know, there is no row drawing that is "the default when they
are invalidated" ... so I suspect the little squares that you report are
due to your drawing function. How do you know that the callback for
only the first record is called?
Concerning table initialization, I usually make rows unusable only when
there are not enough records to fill a table. And you did mention
making columns usable. My table initialization typically looks
something like this:
static void LayerFormTableInit(FormType *form) {
TableType *table;
Int16 irow;
/* Initialize type and value of cells. */
table = (TableType *)ctrlPtr(form, LayerFormTable);
for (irow=0; irow<TableRows; irow++) {
TblSetRowHeight(table, irow, 12);
TblSetRowStaticHeight(table, irow, true);
TblSetItemStyle(table, irow, LayerFormColorColumn,
customTableItem);
TblSetItemStyle(table, irow, LayerFormNameColumn,
customTableItem);
TblSetItemStyle(table, irow, LayerFormVisibleColumn,
checkboxTableItem);
}
/* Make columns visible. */
TblSetColumnUsable(table, LayerFormColorColumn, true);
TblSetCustomDrawProcedure(table, LayerFormColorColumn,
DrawCustomLayerTableItem);
TblSetColumnSpacing(table, LayerFormColorColumn, 2);
TblSetColumnUsable(table, LayerFormNameColumn, true);
TblSetCustomDrawProcedure(table, LayerFormNameColumn,
DrawCustomLayerName);
TblSetColumnSpacing(table, LayerFormNameColumn, 0);
TblSetColumnUsable(table, LayerFormVisibleColumn, true);
TblSetColumnSpacing(table, LayerFormVisibleColumn, 0);
}
- - -
I hope that helps (of course Foster's book would help more),
Greg
Fernando Israel wrote:
>
> Hi there,
>
> I have a 2 column table in a form. The table displays a record in a database
> in each row (which consists in two elements, so the 2 columns). The cell
> items are of the custom type. The issue I have is that the drawing function
> callback associated with the cells is only called for the first record; the
> remaining records are displayed as small squares which I guess is the default
> when they are invalidated (to be drawn).
>
> The logic in the code is, schematically:
> - create the table, making each row unusable in a loop; outside the loop I
> also set the drawing callback function for each column.
> - iterate over the database records and for each record mark a row in the
> table as usable, set the ID, and invalidate it.
>
> Any ideas would be much appreciated.
> Thanks,
> Fernando
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/