> From: Curtis Clauson [mailto:[EMAIL PROTECTED]]
>
> hStrArray = SysFormPointerArrayToStrings(pStrBlock, items);
> MemPtrFree(pStrBlock);
> LstSetListChoices(lstTest, MemHandleLock(hStrArray), items);
>
> According to the frustratingly obtuse docs, I do have to
> allocate and lock the array when I give it to the list
> and keep it allocated and locked until the list is destroyed.
You also need to keep all the actual strings allocated and locked for the
lifetime of the list. Your code does keep the pointer array (hStrArray)
around, but it discards the strings (pStrBlock) which is why this doesn't
work.
> But this does not explain why I only get garbage characters
The array of pointers all point to strings in a block of memory that has
just been MemPtrFree'd, and is therefore garbage.
> BTW: Do you have to unlock a handle before freeing it or does
> freeing it take care of any locks?
You don't. The locks get taken care of automatically.
-slj-
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/