> Hi... i'm having a lot of trouble with a dynamic popup list...
> 
> When i start up my app, everything looks fine... and all the elements are
> in the list... but when i select an element from the list, POSE tells me
> that i've just read from low memory. and after that the app dies with a
> bus error!...
> 
> I've tried to crop my eventhandling down to frmOpenEvent only, and it
> still dies....
> 
> Here is the code i use for drawing the list :
> 
> void ProjectListDrawFunction(UInt itemNum,RectanglePtr bounds,CharPtr
> pUnused)
> {
>    project_rec prec;
>    DBOpen();
>    if(GetProjectRec(itemNum,&prec)!=-1)
>    {
>  
> WinDrawChars(prec.Name,StrLen(prec.Name),bounds->topLeft.x,bounds->topLeft
> .y);     
>    }
>    else
>       WinDrawChars("Error getting project name",StrLen("Error getting
> project name"),bounds->topLeft.x,bounds->topLeft.y);
>    DBClose();  
> }
> 
> and here is the code i go through in the eventhandler (shorted) :
>                ListPtr lptr=GetObjectPtr(FrmGetActiveForm(),ProjectList);
>                if(lptr!=NULL)
>                {
>                   Word sel=LstGetSelection(lptr);
>                   if(sel!=noListSelection)
>                   {
>                      CharPtr pname=LstGetSelectionText(lptr,sel);
>             }
>                }
> 
> 
> I know from debugging with gdb, that the point where it dies is at
> LstGetSelectionText
> here are the values of the variables at runtime :
> 
> *lptr
> (gdb) print *lptr
> $1 = {id = 5002, bounds = {topLeft = {x = 1, y = 18}, extent = {x = 156,
>       y = 33}}, attr = {usable = 0, enabled = 1, visible = 0, poppedUp =
> 0,
>     hasScrollBar = 0, search = 0, reserved = 0}, itemsText = 0x0,
>   numItems = 1, currentItem = 0, topItem = 0, font = stdFont, popupWin =
> 0x0,
>   drawItemsCallback = 0x1001b400 <ProjectListDrawFunction>}
> 
> sel
> (gdb) print sel
> $2 = 0
> 
> pname
> (gdb) print pname
> $3 = 0x4 ""
> 
> 
> Could someone please try to guide me in the rigth direction here.... 
> 
> Jimmy

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to