I see a couple of issues...

You only need to call TblSetLoadDataProcedure and
TblSetSaveDataProcedure once for each column so you can take them out of
the loop.

When you pass the pointer to TblSetItemPtr, you cannot immediately call
MemHandleFree.  The chunk has to remain locked until the table is
deleted as it may be needed whenever the table is redrawn.

Bill MacAdam
Visual Solutions
847-420-2702


-----Original Message-----
From: Allan Burgess [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 3:05 AM
To: Palm Developer Forum
Subject: Re: Tables & Databases


Is this post visible to anyone? I am not getting any replies. Hope the
question is not too stupid...

"Allan Burgess" <[EMAIL PROTECTED]> wrote in message
news:79390@palm-dev-forum...
>
> 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/

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to