Hi
This is the solution for your problem. The problem with your code is
LstGetSelectionText(lptr,sel); cannot work for dynamic textitems in a list.
The list control doesn't know the item u selected. because you are not
storing the item sin list statically. it will work only for static list
items (which will be created in constructor)
case popSelectEvent:
switch ( event->data.lstSelect.selection )
{
case YOURLIST:
listP = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,YOURLIST));
listsel = LstGetSelection(listP);
GetProjectRec(listsel,&prec) // get the selectd item from
database
pname=MemPtrNew(StrLen(prec.Name)+1);
StrCopy(pname,prec.Name);
handled = true;
break;
}
Thank U
Narasimha Prasad B.
[EMAIL PROTECTED]
----- Original Message -----
From: Nielsen, Jimmy Selgen <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Saturday, February 19, 2000 7:11 PM
Subject: RE: Dynamic popup list weirdness (long)
> hmmmmm..... that didnt work... i changed my draw function to look like
this
> :
> void ProjectListDrawFunction(UInt itemNum,RectanglePtr bounds,CharPtr
> pUnused)
> {
> project_rec prec;
> CharPtr pname;
> DBOpen();
> if(GetProjectRec(itemNum,&prec)!=-1)
> {
> pname=MemPtrNew(StrLen(prec.Name)+1);
> StrCopy(pname,prec.Name);
> }
> else
> {
> pname=MemPtrNew(StrLen("Error getting project name")+1);
> StrCopy(pname,"Error getting project name");
> }
> WinDrawChars(pname,StrLen(pname),bounds->topLeft.x,bounds->topLeft.y);
>
> DBClose();
> return;
> }
> BUT... displaying the list isnt the problem!... the list display's just
> fine.... and all the strings in it looks fine too!
> the problem occurs when i select something from the list!... And it doesnt
> matter if i handle the event myself, or i leave it up to the OS...
>
> Any other suggestions ?
>
> Jimmy
>
>
> >-----Original Message-----
> >From: McMicken, Steven [mailto:[EMAIL PROTECTED]]
> >Sent: 18. februar 2000 18:06
> >To: Palm Developer Forum
> >Cc: '[EMAIL PROTECTED]'
> >Subject: RE: Dynamic popup list weirdness (long)
> >
> >
> >You need to allocate space for your CharPtr using pname = MemPtrNew (xx),
> >where xx is the size you want to allocate. Right now, you don't have any
> >space allocated to receive the string, thus the bus error.
> >
> >Regards,
> >
> >Steve
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html