The following script crashes at StrCopy:
FieldPtr fld;
MemHandle recH;
MemHandle oldTextH;
Char *record;
Char *text;
// Get a pointer to the memo field.
fld = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, ViewErrandField));
CurrentRecord = 0; // This is the CurrentRecord entry
DmRecordInfo (MemoDB, CurrentRecord, &attr, NULL, NULL);
recH = DmQueryRecord (MemoDB, CurrentRecord);
record = (Char *) MemHandleLock(recH);
MemHandleUnlock(recH);
text = "unfit";//just something to bite on!
StrCopy(text, record);
oldTextH = FldGetTextHandle(fld);
FldInsert(fld, text, StrLen(text));
FldSetTextHandle (fld, record);
//Dispose of the old handle to prevent a memory leak.
if (oldTextH)
MemHandleFree(oldTextH);
I have this script which compiles OK but when I run it on POSE it
crashes with the message 'DataMgr (1.0) just wrote to memory location
0x0004C722, which is in the storage heap' at StrCopy.
If I use FldSetTextHandle (fld, record); instead I get the message,
'illegal implicit conversion from char* to struct _opaque*'.
Sorry this is just trial and error but my C knowledge is very
limited and none of the Palm docs or books are game to talk about
the topic of getting data into fields.
I can get the data into the field OK but I am trying to prevent
editing the memopad data.
Barry
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/