Hi,
I am trying to set a table to access data. I can point a field to a point in
a record, but I cannot do the same to a table. The documentation indicates
that I should be able to use the same type of procedure to point the table
element to a record field in my database. I have tried to implement the same
code in a TableLoadDataFuncType but only get memory handle errors, even if I
do not attach to my callback with TblSetLoadDataProcedure.
I am missing something but cannot find the problem. Any sample code or
suggestions appreciated.
Field code that works. OS_SITE is offsett of field in record, C_SITE is
Column in database:
===============================================================
recH = DmQueryRecord(gDB, i);
if (recH) {
FldSetText(fldPtr, recH, OS_SITE, C_SITE );
}
FldDrawField(fldPtr);
Table Equivilant:
===============================================================
for (i = 0; i < numRecs; i++) {
recH = DmQueryRecord(gDB, i);
if (recH) {
TblSetItemStyle (tblS, i, C_SITE, textTableItem);
TblSetLoadDataProcedure(tblS, C_SITE, loadDataCallback);
TblSetSaveDataProcedure(tblS, C_SITE, SaveDataCallback);
recP = (ParkITDBPtr)MemHandleLock(recH);
TblSetItemStyle (tblS, i, C_CLNT, labelTableItem);
TblSetItemPtr (tblS, i, C_CLNT, recP->Client);
TblSetItemStyle (tblS, i, C_REGO, labelTableItem);
TblSetItemPtr (tblS, i, C_REGO, recP->Rego);
TblSetRowUsable (tblS, i, true);
MemHandleUnlock (recH);
}
}
TblDrawTable(tblS);
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/