On Fri, Aug 08, 2003 at 03:00:09PM -0700, Steve K wrote:
> Dave,
> 
> Thank you for the advice.  I am having a real hard time dealing with
> Memhandles and char*s.  Been awhile since i'm done C programming and never
> played on a palm before.  Anyway, you have cleared things up quite a bit
> with your advice, however, I am still not getting the list to load.
> 
> I have modified to the code to your suggestions as follows:
> (maybe I misread the ... but who knows)
> 
> static char* gPlateString =
> "PL3/16x\0PL1/4x\0PL5/16x\0PL3/8x\0PL1/2x\0PL5/8x\0";
> static char** gListString;
> MemHandle gStringH;
> 
> static Boolean PopulateList(void)
> {
>  FormType* frmP = FrmGetActiveForm();
>  ListType* lstP = (ListType*) FrmGetObjectPtr(frmP, lstDesc);
> 
>  gStringH = SysFormPointerArrayToStrings(gPlateString, 6);
>  gListString = (char**)MemHandleLock(gStringH);
> 
>  LstSetListChoices(lstP, gListString, 6);
>  LstDrawList(lstP);
>  MemHandleUnlock(gStringH);
> 
>  MemHandleFree(gStringH);

This handle must remain allocated for the lifetime of the
list. Basically, until the form that contains the list is closed. Do the
MemHandleFree when you handle frmCloseEvent, and don't forget to call
LstSetListChoices with a null pointer just to be on the extra safe side.

-- 
Dave Carrigan
Seattle, WA, USA
[EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

Dave is currently listening to Jason and the Scorchers - Harvest Moon (Fervor)

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to