At 12:00am -0800 01-02-22, Palm Developer Forum digest wrote:
> // Allocate handle to store the text from the list (+ 16 extra).
> newTextH = MemHandleNew(StrLen(ptrToText)+16);
> // Get pointer to memory and lock.
> tempPtr = MemHandleLock(newTextH);
> // Copy list text into memory pointer.
> StrCopy(tempPtr, ptrToText);
>
> // Get old text handle.
> oldTextH = FldGetTextHandle(ptrToField);
> // Set the field's new text.
> FldSetTextHandle(ptrToField, newTextH);
> // Unlock the new text handle.
> MemHandleUnlock(newTextH);
One minor nit. Once you've called FldSetTextHandle, the field code
effectively "owns" the handle. Thus you should avoid messing with the
handle following this call, which means that the unlock should happen
before you call FldSetTextHandle.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/