Hi,
I copied a bunch of code from the "To Do" example, for editing a note at the
end of a record. When I open my note editing form, I do the following:
void get_note(FieldPtr fld, UInt16 recno) {
UInt16 offset;
MemHandle recordH;
MemPtr recordP;
char *p;
recordH = DmQueryRecord(MyDB, recno);
recordP = MemHandleLock(recordH);
p = (char *) (((UInt32) recordP) + sizeof(MyDBRecord)); //note appended
to end of record
offset = p - (char *) recordP;
FldSetText(fld, recordH, offset, StrLen(p)+1);
MemHandleUnlock(recordH);
}
When the user taps the DONE button, I do the following:
FldCompactText(fld);
FldSetTextHandle(fld, 0);
This is almost exactly out of the To Do code, and appears to work fine. The
existing note text appears, I make changes and tap DONE. However, what's
happening is that the record is getting extra bytes of garbage at the end.
So if the record originally contained:
<stuff> ABC
where ABC is the note, and I append DEF to it, after the update, the actual
database record contains something like:
<stuff> ABCDEFxyz
where xyz is a seemingly variable number of extra bytes of gargabe. This
also happens when I make the note SHORTER than it was, although it does not
seem to happen when I initially create a note. Can anyone see what I am
doing wrong?
Thanks,
Tom Ward
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html