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
> 

Reply via email to