I created this function to make my work easier when changing a text in a NON
editable field.
void CopyCharPtrToField( const Char * text, UInt16 fieldID)
{
Char* txtPtr;
FormPtr frm = FrmGetActiveForm( );
FieldPtr fldP;
fldP = FrmGetObjectPtr(frm, FrmGetObjectIndex( frm, fieldID ) );
txtPtr = FldGetTextPtr( fldP );
if( txtPtr )
{
FldSetTextPtr( fldP, NULL );
MemPtrFree( txtPtr );
}
txtPtr = MemPtrNew ( StrLen(text)+1);
StrCopy(txtPtr, text);
FldSetTextPtr( fldP, txtPtr );
FldRecalculateField(fldP, false);
FldDrawField( fldP );
}
It works perfectly when I use the m505 with PalmOS 4.0 rom file. But, if I
use the m100 with PalmOS 3.5.1 rom file, the PalmOS emulator show me the
following error:
Starter (1.0) just read from memory localtion 0x00000000, which is in low
memory.
"Low memory" is defined as the first 256 bytes of memory. It should not be
directly accessed by applications under any circunstances.
When debuging, I found that the error occurs at the line where I call
FldSetTextPtr( fldP, NULL ) before freeing the previous string.
I have no idea what to do anymore... Any help?
Thanks,
Leonardo Holanda.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/