Hey,
Whats wrong with this code. Im trying to display bitmap in table cell. the
table is supposed to have 8 rows and 2 columns. But it complies and doesnt
show any table. Im pretty sure im doing somehting wrong with
TblSetItemStyle(tableP, i, 1, customTableItem) but i dont know what. Im new
at palm prog. by the way. Thanks
static Boolean TableFormHandleEvent(EventPtr event)
{
Boolean handled = false;
FormPtr frm;
switch (event->eType)
{
case frmOpenEvent:
{
frm = FrmGetActiveForm();
FrmDrawForm(frm);
UpdateTable();
WinDrawGrayLine(2,145,158,145);
handled = true;
break;
}
default:
break;
}
}
void drawCallback (void *tableP, Int16 row, Int16 column, RectangleType
*bounds)
{
Int16 nValue = TblGetItemInt(tableP,row,column);
MemHandle bitmapH;
BitmapPtr bitmapP;
bitmapH = DmGetResource('Tbmp', testBit);
if ( !bitmapH )
return;
bitmapP = (BitmapPtr) MemHandleLock (bitmapH);
WinDrawBitmap (bitmapP, bounds->topLeft.x, bounds->topLeft.y);
MemHandleUnlock (bitmapH);
}
void UpdateTable()
{
FormPtr frmP = FrmGetActiveForm();
TablePtr tableP = FrmGetObjectPtr( frmP,
FrmGetObjectIndex(frmP,Table));
UInt nNumRows = TblGetNumberOfRows(tableP);
UInt i = 0;
for (i = 0; i < nNumRows; i++)
{
TblSetItemStyle(tableP, i, 0, numericTableItem);
TblSetItemInt(tableP, i, 0, i);
TblSetItemStyle(tableP, i, 1, customTableItem);
}
for (i = 0; i < 2; i++)
{
TblSetColumnUsable(tableP,i,true);
}
TblSetCustomDrawProcedure(tableP,1,drawCallback);
TblDrawTable(tableP);
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/