I get this error "field.c, Line:6001, FldSetText - text longer than
maxChars" ONLY when trying to read a number larger than 255 (8-bit).
The variable I store the data in is 16 bit Int (data).
the error occurs on line: FldSetTextHandle(FieldPtr, h);
Code:
///////////////////////////////////////////////////////////////////////////////////////////////////////////
UInt16 data,
controlID;
FormType* pForm;
FieldType* FieldPtr;
MemHandle h, oldHandle;
char* p;
pForm = FrmGetActiveForm();
h = MemHandleNew(50); // allocate chunk of memory in
heap
p = MemHandleLock(h); // prevent the chunk from moving
(lock)
// and obtain pointer to location
StrIToA(p, data);
MemHandleResize(h, StrLen(p)+1);
MemHandleUnlock(h);
FieldPtr = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,
controlID));
oldHandle = FldGetTextHandle(FieldPtr);
FldSetTextHandle(FieldPtr, h);
FldRecalculateField(FieldPtr, true); // refresh the field
if(oldHandle)
MemHandleFree(oldHandle);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
any suggestions?
thanks,
~Tony
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/