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