Just minor observations: You need MemHandleNew(11) having an extra byte for trailing zero.
Another thing: I am not sure, but FldSetTextHandle(fld, NULL) might free the handle, assuming that you don't need it, but you actually do. I would comment it out to see if it helps. Michael -----Original Message----- From: Dave Mottorn [mailto:[EMAIL PROTECTED]] Sent: Monday, 26 November 2001 1:05 PM To: Palm Developer Forum Subject: Editing Fields I'm developing my first Palm OS Application and I have a form with about 15 fields. The user can enter information into about 6 of the fields and the program can update any of the fields. I can get it to work ok as long as the user doesn't enter any data. In other words the program can update the fields. As soon as the user enters data the field seems to act differently and I get "invalid handle" or "field under-locked" depending on what version of the code it is. What follows is one version of the code that updates the field. I followed one of the examples I found on-line pretty closely to arrive at this. It didn't seem to like locking a handle that had just been set to null so I commented that out. I've tried about every variation of the examples I've found but nothing works completely. There must be something I don't know about. void UpdateField(ULong newtime, ULong fieldname){ FieldPtr fld; FormPtr frmP; VoidHand oldhand; CharPtr fldptr; Int fldIndex; frmP = FrmGetActiveForm(); fldIndex = FrmGetObjectIndex(frmP, fieldname); fld = FrmGetObjectPtr(frmP, fldIndex); oldhand = FldGetTextHandle(fld); if (oldhand){ // FldSetTextHandle(fld, NULL); fldptr = MemHandleLock(oldhand); StrIToA(fldptr, newtime); MemPtrUnlock(fldptr); FldSetTextHandle(fld, oldhand); FldDrawField(fld); } else { oldhand = MemHandleNew(10); fldptr = MemHandleLock(oldhand); StrIToA(fldptr, newtime); MemPtrUnlock(fldptr); FldSetTextHandle(fld, oldhand); FldDrawField(fld); } } -- 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 Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
