Thanks Steven, however, that code is just for debugging (and actually seems
to work fine declared as just a char).

The problem remains without this code (perhaps I shouldn't have included it
in the code sample). Any other suggestions/pointers?

Regards,

John.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of McMicken,
Steven
Sent: 21 February 2000 15:23
To: Palm Developer Forum
Cc: '[EMAIL PROTECTED]'
Subject: RE: Error in TableLoadDataFunc


Are you looking at the value of DB in a debugger, or are you taking the
return value in 'c'.  You allocate c as a single character, yet StrIToA
returns a character pointer, which will require at least two locations.  Use
char *c, then allocate space with a call to MemPtrNew.

Regards,

Steve

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 21, 2000 10:19 AM
> To: Palm Developer Forum
> Subject: Error in TableLoadDataFunc
>
>
>
> Can anyone spot the error in this? I'm trying to initialise a
> table prior to
> a FrmDrawForm. The DmNumRecords and DmQuery both seem to
> cause problems.
> With DmNumRecords returning '4092'! when DB only has 2
> records in it. DB is
> a global variable and IRecordTypePtr is a pointer to a record
> structure.
> Preceding functions can call DmNumRecord correctly and I
> can't work out
> what's wrong with this function. Can you help?
>
> Perhaps I don't understand how the OS uses TableLoadDataFunc
> functions. If
> anyone's got some simple source code for setting up and using
> a table that
> would be helpful too.
>
> Thanks in anticipation,
>
> John.
>
> static Err ListViewGetSummary (VoidPtr table, Word row, Word column,
>     Boolean editable, VoidHand textH, WordPtr textOffset, WordPtr
> textAllocSize,
>     FieldPtr fld)
> {
>
>     Word recordNum;
>     VoidHand recordH;
>     FieldAttrType attr;
>     IRecordTypePtr recordP;
>     IRecordTypePtr nilPtr = NULL;
>     UInt maxrecords = 0;
>     char c;
>
>     // Get the record number that corresponds to the table item.
>     // The record number is stored as the row id.
>     recordNum = TblGetRowID (table, row);
>
> ErrDisplay("Check Point 2");
> maxrecords = DmNumRecords(DB);
> ErrDisplay("Check Point 3");
> StrIToA(&c, maxrecords);
> ErrDisplay(&c);
>
>         recordH = DmQueryRecord(DB, recordNum);
>         ErrFatalDisplayIf ((! recordH), "Record not found");
> ErrDisplay("Check Point 4");
>         recordP = (IRecordTypePtr) MemHandleLock(recordH);
>
>
>         *textOffset = &recordP->summary - ((CharPtr) recordP);
>         *textAllocSize = StrLen (&recordP->summary) + 1;  //
> one for null
> terminator
>         *textH = recordH;
>
>         MemHandleUnlock(recordH);
>
>         // Set the field to support auto-shift.
>         if (fld)
>             {
>             FldGetAttributes (fld, &attr);
>             attr.autoShift = true;
>             FldSetAttributes (fld, &attr);
>             }
>
> ErrDisplay("Check Point 4");
>     return (0);
> }
>
>
>
> --
> "This message is brought to you by Reuters.net;
> Any views expressed are those of the sender, except where the sender
> specifically states them to be the views of Reuters Limited."
>
> --
> For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palm.com/devzone/mailinglists.html
>
>

--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html


--
"This message is brought to you by Reuters.net;
Any views expressed are those of the sender, except where the sender
specifically states them to be the views of Reuters Limited."


-- 
"This message is brought to you by Reuters.net;
Any views expressed are those of the sender, except where the sender
specifically states them to be the views of Reuters Limited."

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to