I am not sure if this is the *correct* way of doing this.. nor am I sure
that if this
works.. but you can try this.

Although there is no LstGetListChoices ( ListPtr) function to go with
LstSetListChoices ( ... ),  you can see your gStringArray in
listP->itemsText.
Maybe you can do this?

case frmCloseEvent:
    ListPtr listP = FrmGetObject ( frmP, FrmGetObjectIndex ( frmP,
DateUnmamed1118List ) );
    if ( listP->itemsText )
    {
        MemPtrUnlock ( listP->itemsText );
        MemPtrFree ( listP->itemsText );
    }

or something along the way.. I feel like this might cause a crash
somewhere..
but I *might* work too...

If you get a chance to try it, let me know =)

-Ji


"S S" <[EMAIL PROTECTED]> wrote in message news:42915@palm-dev-forum...
>
> Hello!
>
> I have my Data Form in my application and in this form
> I initialize List resource in DataFormInit function:
>
> gStringsHandle=DmGetResource('tSTL', ZonesStringList);
> if(gStringsHandle)
>  {
>   StrListPtr stringsPtr;
>
>   listP=FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
> DataUnnamed1118List));
>   stringsPtr=MemHandleLock(gStringsHandle);
>
>
>
gStringArrayH=SysFormPointerArrayToStrings(stringsPtr->firstString,stringsPt
r->numStrings);
>
>
LstSetListChoices(listP,MemHandleLock(gStringArrayH),stringsPtr->numStrings)
;
>
>       if (gStringsHandle)
> MemHandleUnlock(gStringsHandle);
>               if (gStringsHandle)
> DmReleaseResource(gStringsHandle);
>    }
>
> where StrListPtr is
>
> typedef struct StrListType{
> char prefixString;
> char numStringsHiByte;
> char numStrings;
> char firstString[1];
> }*StrListPtr;
>
> You can see that I unlock and release gStringsHandle,
> but gStringArrayH is still unlocked. When I unlock
> gStringArrayH in DataInitForm, my List didn't work and
> I unlock it in DataFormHandleEvent() like this
>
>     case frmCloseEvent:
>         if (gStringArrayH)
> MemHandleUnlock(gStringArrayH);
> gStringArrayH=NULL;
> break;
>
> But this implementation requires declaration of
> gStringArrayH as a global variable and it is very bad
> for memory.
>
> How can I do it (unlock) right??
>
> Thanks,
> Sergei
>
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
>



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

Reply via email to