Seems to be the same as I do, I only use the NULL re-initialize
becouse the palm website recomends it.
The next code also reproduces the problem:
// At startup
static char *messages[10] = {"aap","noot","mies"};
static int numMessages = 3;
static char *messages2[10] = {"kees","jan"};
static int numMessages2 = 2;
LstSetListChoices(messageList, messages, numMessages);
LstDrawList(messageList);
// After user pushes some button
LstSetListChoices(messageList, messages2, numMessages2);
LstDrawList(messageList);
The result is that all three origenal items are still
visable but only the upper two are selectable. It seems
to me that I miss some update event or whatever.
> -----Original Message-----
> From: Fawcett, Mitch [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 12, 1999 14:27
> To: '[EMAIL PROTECTED]'
> Subject: RE: Updating a list with LstSetListChoices
>
>
> Here is how I update a list after I make adds/edits/deletes to the
> underlying data that it displays. I don't re-initialize the
> array of strings
> back to NULL values like you do. I just build a new array
> and let iNumLists
> value tell LstSetListChoices where to stop.
>
> plst = (ListPtr) GetObjPtr_vp (lstList);
> iNumLists = DmNumRecords (GdbListOfLists); // the source of
> strings for
> the list.
> // open database
> for (j=0; j < iNumLists; j++)
> {
> VoidHand vhListRec = DmQueryRecord (GdbListOfLists, j);
> pPackedList = MemHandleLock (vhListRec);
> GarrayOfLists[j] = pPackedList->cpListName;
> MemHandleUnlock (vhListRec);
> }
> LstSetListChoices (plst, GarrayOfLists, iNumLists);
> LstDrawList (plst);
>
>
> > -----Original Message-----
> > From: Sander Kloos [SMTP:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 12, 1999 8:09 AM
> > To: [EMAIL PROTECTED]
> > Subject: Updating a list with LstSetListChoices
> >
> >
> >
> > Hi all,
> >
> > I'm updating a list (not a popup) from my application after
> the number of
> > items has changed,
> > for example becouse one item in the list was deleted. The
> result seems to
> > be
> > that the list's
> > internal structure is updated indeed but not the display itself. The
> > display
> > itself gets jammed
> > up. When I walk through the items in a loop and display
> each of them in an
> > alert box,
> > everything seems fine with the used char * array and item
> counter (both
> > static). Before I
> > change anything in the array I first call LstSetListChoices
> with a NULL
> > pointer with number of
> > items set to 0. after updating the array, I call
> LstSetListChoices with a
> > pointer to the array and
> > number of items set to the actual number of items in the
> array. Finaly I
> > call LstDrawList to
> > display the modified list. The char array's themselfs are
> allocated with
> > 'new' and free'ed with
> > 'delete'.
> >
> > Please let me know what I am doing wrong.
> >
> > Sander
> >
>