how can i copy the value of a tlist to other tlist,then destroy the first tlist and keep the values in the second tlist...can you dend me the code to do that? thanks...
I'm not sure if this is what you're looking for...
procedure CopyList(fromList,toList: TList);
var x: longint;
begin
for x := 0 to fromList.count-1 do
begin
toList.Add(fromList[x]);
end;
end;
That procedure will put all of the items in the first list into the second list. Then you can safely free the first list. Freeing a list does not free the objects in the list so the second list will have the same data that the first had, if that makes sense.
Actually, a Clear won't free the data objects either. You have to loop through the list and free them yourself. Clear just clears the pointers out of the list. TealWren
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.