Blitz (21/172)

From:Curt Esser
Date:7 Sep 2000 at 02:42:13
Subject:Re: ListViews

Hi Neil,

----- Original Message -----
From: David McMinn <D.Mcminn@eee.rgu.ac.uk>

> Hi Neil
>
> > It's when I want to add something to guilist() and update the listview
that is
> > all goes wrong :) What is the correct way to do this? I obviously need
to
> > increase the size of the linked list, so do I just do
>
> Nononononononono. The whole point of lists is that you do not need to
increase
> the size (unless of you course you *really* mean to increase the size of
the
> list), you just add and remove items from the list.

David is right, as usual. But he forgot to point out what I think is the
real answer to your question, the part about Dim'ing the list.

Lists are NOT treated the same as a standard array, so the normal method is
to simply Dim the list to a value much larger than you ever expect to use,
then add the items as needed.

For example, if I was expecting to have a maximum of 50 ~ 100 items in a
list, I would Dim it to say 2000, or so to be safe...

The key point is that the list will NOT waste any memory on the unused
items - it only sets aside the memory for each item when it is actually
added to the list, whereas Dim'ing a standard array DOES set aside the
entire memory for the number of items requested, right at the start.
>
> i.e. to add another thing to the list you would do:
>
> If AddItem(guilist()) Then guilist()\entry = <whatever>
>
> > Dim List guilist.lview(count+1) : ResetList guilist()
>
> If you reeeeeeeeeeeally need to do this then you need to copy all your
data out
> of your list before you re-Dim it and then copy it back, otherwise the
list
> will be empty, or full or crap.
>
> > or is there a better way? If I do it like this, then add all the data
into
> > the list again, including the new piece of data. Then, I do
>
> Dunno about better, but the correct way is this:
>
> > GTChangeList 0,1
>
> ; (Add|remove|kill|burn) items, do whatever you want to the list here
>
> > GTChangeList 0,1,guilist()
>
> And now it should show the new list data.
>
> > What do I do?
>
> Do it properly. Even the manual, BUMs, and online help all explained
> GTChangeList I think.
>
>
> --
> |) /\ \/ ][ |) |\/| c |\/| ][ |\| |\| | dave@satanicdreams.com
> http://members.xoom.com/David_McMinn | ICQ=16827694
> For Sale: Parachute. Only used once, never opened, small stain.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
> For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie