I'm a newbie to Palm OS development, and I cannot get tables to work
at all. I'm using MetroWerks CodeWarrior 8. Using Constructor, I
create a simple form with a table (on the main form, the table is
called "Items", so the generated ID is MainItemsTable). I've included
some test code below that does not work for me. The very first call
to TblSetItemsStyle(...) gets this error in the Palm emulator:
"Test (1.0) called SysFatalAlert with the message: "Table.c, Line:
2113, Invalid parameter"
After unsuccessfully trying many different things, I recreated the
project from scratch and tried it all over again, with the exact same
results. I traced through with debug, and all the parameters passed
into TblSetItemStyle seem correct: a valid ptbl, row = 0, col = 0,
labelTableItem being the right value. Is this a bug with CodeWarrior
8 or I am doing something stupid? If I hit "Continue" on the error
window, I will get the error for every call to TblSetItemStyle and
will end up getting memory errors (in my first test project, I would
end up with a corrupted form, with the table itself being placed at
wierd screen locations like 8000x, -2342y).
static void MainFormInit(FormType * frmP)
{
TablePtr ptbl;
Int16 row, col, rowCount, colCount;
ptbl = (TablePtr)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
MainItemsTable));
colCount = 3;
rowCount = TblGetNumberOfRows(ptbl);
for(row = 0;row < rowCount;row++)
{
for(col = 0;col < colCount;col++)
{
TblSetItemStyle(ptbl, row, col, labelTableItem);
}
}
for(col = 0;col < colCount;col++)
{
TblSetColumnUsable(ptbl, col, true);
}
for(row = 0;row < rowCount;row++)
{
for(col = 0;col < colCount;col++)
{
TblSetItemPtr(ptbl, row, col, "Test");
}
}
Quote:}