you can't free the handle after you give it to the field. You would be better off if you: =>get the current handle from the field creating your new handle copy your string to the handle assign the new handle to the field =>delete the old handle =>do not delete the new handle
----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[email protected]> Sent: Friday, June 30, 2000 12:10 PM Subject: Reading directly from unlocked memory chunk: Please help Hi, I am trying to display text on to a field object by using the following function :- void DisplayTxtToField(FormPtr frm, UInt16 fieldID, Char* tempString) { MemHandle userTextH; FieldPtr fldP; Err err; fldP = FrmGetObjectPtr(frm,FrmGetObjectIndex (frm, fieldID)); userTextH = MemHandleNew( StrLen(tempString) + 1); StrCopy(MemHandleLock(userTextH), tempString ); MemHandleUnlock(userTextH); FldSetTextHandle(fldP,userTextH); FldDrawField(fldP); err = MemHandleFree(userTextH); } where tempString stores the text to be displayed.... The first time I call the function it works fine...but the second time around I get this error : Browser has just read directly from an unlocked memory chunk. Is there something wrong in the code? Thanks in advance vishy ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
