I dont know whether my code is wrong or not.

What happened is all parameters are correct but

Function "LstSetListChoices" is not working..

It crushes the emulator without error message..

Of course, It will be my mistake in the code..

I will just show u the code anyway..

Please reply this message if u have any sugguestion.. 

Thank you.
__________________________________________________

void FillLetsCookFormListWithData(ListType *titleLst, ListType *categoryLst, 
ListType *yieldLst) {
        DBRecipePtr             dbRecipePtr;
        Char                    **titleItemList;
        Char                    **categoryItemList;
        Char                    **yieldItemList;
        int                             i;
        const int               nItems = GetNumberOfRecipeRecord();
        MemHandle h;    
        
        gListNumItems=numberOfItems;
        titleItemList = (Char **) MemPtrNew(nItems * sizeof(Char *));
        categoryItemList = (Char **) MemPtrNew(nItems * sizeof(Char *));
        yieldItemList = (Char **) MemPtrNew(nItems * sizeof(Char *));
        
        if(nItems != 0) {
                for(i = 0; i < nItems; i++) {
                h = DmGetRecord(gDatabase2, i);
                if (h) { // could fail due to out of memory!
                dbRecipePtr = (DBRecipePtr) MemHandleLock(h);           
                //dbRecipePtr = GetRecipeByIndex(i);
                titleItemList[i] = (char 
*)MemPtrNew(StrLen(dbRecipePtr->title));
                StrCopy(titleItemList[i], dbRecipePtr->title);
                categoryItemList[i] = (char 
*)MemPtrNew(StrLen(dbRecipePtr->category));
                StrCopy(categoryItemList[i], dbRecipePtr->category);
                yieldItemList[i] = (char 
*)MemPtrNew(StrLen(dbRecipePtr->yield));
                StrCopy(yieldItemList[i], dbRecipePtr->yield);
                MemPtrUnlock(dbRecipePtr);
                DmReleaseRecord(gDatabase2, i, true);                   
                }
                }
                
                LstSetListChoices(titleLst, titleItemList, nItems);
                LstSetListChoices(categoryLst, categoryItemList, nItems);
                LstSetListChoices(yieldLst, yieldItemList, nItems);
        }
}

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

Reply via email to