I have the following code (which once upon a time worked) for drawing lables
in a table as custom items. The table is 2 column, col 0 is checkboxes and
col 1 is the custom item.
//from the form load function
for(i=0;i<numRows;i++)
{
TblSetItemStyle(table, i, 0, checkboxTableItem);
TblSetItemInt(table, i, 0, 0);
TblSetItemStyle(table, i, 1, customTableItem);
}
TblSetColumnUsable(table, 0, true);
TblSetColumnUsable(table, 1, true);
TblSetCustomDrawProcedure(table, 1, TestSetDrawProtocolName);
//end code snippet
T
The draw procedure (very simple) gets a record number from the row ID, looks
in the database, grabs the right text and draws it. When I run though, the
table does not show the col 1 data. So I put a breakpoint in the custom
draw routine, and it does not get called at all. But, I get no warnings or
errors at any time that give me any hint as to why this might happen. I'm
using CW 8.2 . . .
Can someone clue me in? here is the draw procedure that (apparently) is not
getting called (I put a bp on every line jic, and everything else about the
table works just right):
static void TestSetDrawProtocolName(MemPtr mp, Int16 row, Int16 column,
RectanglePtr r)
{
TablePtr table = (TablePtr)mp;
Char buf[40];
UInt16 index;
Protocol * p;
MemHandle h;
index = TblGetRowID(table,row);
h = DmQueryRecord(gProtocolDB, index);
if(h)
{
p = (Protocol *)MemHandleLock(h);
StrCopy(buf,p->Name);
MemHandleUnlock(h);
}
else
{
StrCopy(buf,"--Empty--");
}
DrawCharsToFitWidth(buf, r);
}
paul
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/