Copy TStringList to TListBox



Hello all,

I have a TStringList containing some strings, with associated objects.
I wish to copy this list to a TListBox, so that the Listbox contains
a separate copy of the Stringlist items (including the objects).
I use Assign, but it seems that this only assigns pointers to the original
objects in the Stringlist instead of copying them to new objects:

ListBox1.Clear;
ListBox1.Items.Assign(StringList1);
StringList1.Clear; //this changes >=1 objects in ListBox1!

(The objects contain a record with string fields, I can watch them in the
debugger. One of the strings of at least one of the objects changes.)
Am I missing something basic?



Regards,
Arjan
.



Relevant Pages

  • Re: Combobox help
    ... then put text strings as the ... > Hi Ken - I want ALL THREE options to display in the combobox as THREE ... > separate lines, and then I want the user to select ONE of the three ... >>> Sue Compelling ...
    (microsoft.public.access.forms)
  • Re: Symbols, metacircular evaluation, external representation.
    ... they treated as strings instead of a separate data type? ... a separate or more limited language to do your macros, ... I doubt that's all the application of external representations. ...
    (comp.lang.scheme)
  • Re: Date using input
    ... You want to separate the dd from the mm and from the year. ... Look up str.join, which is pretty much the inverse of split, or simply look up how to concatenate strings with the "+" operator. ... Try writing one complete script, complete with a single definition, and a single call to that definition, perhaps printing the result calling that definition. ...
    (comp.lang.python)
  • Re: Search utility?
    ... Different text strings. ... Most web sites with search engines look for wordone OR wordtwo. ... Perhaps there is a way to search two separate strings in one pass. ...
    (comp.os.os2.apps)
  • Re: Why leave the error handling to the caller?
    ... of strings separated by commas. ... ptr - pointer allocated with malloc, ... Then if we put dlist_add into a separate file, suddenly we got a dependency, and the old problem of you want a list of strings and that requires pulling in a whole hierarchy of files. ...
    (comp.lang.c)