narek adonts Well-Known Member Licensed User Longtime User Jun 12, 2015 #1 Hi I am adding a list to a map. I am adding the same list but with the content changed to a map with different keys but at the end I am getting the same List for all the Keys in the Map. Any suggestions? Narek
Hi I am adding a list to a map. I am adding the same list but with the content changed to a map with different keys but at the end I am getting the same List for all the Keys in the Map. Any suggestions? Narek
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2015 #2 Yes. Create a new list each time: Code: Copy Dim list1 As List 'same variable name, new list list1.Initialize Upvote 0
Yes. Create a new list each time: Code: Copy Dim list1 As List 'same variable name, new list list1.Initialize
narek adonts Well-Known Member Licensed User Longtime User Jun 14, 2015 #3 I tried but without success. I have a global variabale - curAttributes which I am frequently cleaning. Before Cleaning I am trying to save it in map like this Code: Copy Public Sub SaveAttributes Dim tmpAtt As TextAttributes=ActiveTXT.SaveTextAttributes curAttributes.Add(tmpAtt) Dim tmpattlist As List tmpattlist.Initialize2(curAttributes) mapID.Put(curImageID.tmpattlist) End Sub NO SUCCESS. when retrieving a List from any Key I am always getting the latest List. Narek Upvote 0
I tried but without success. I have a global variabale - curAttributes which I am frequently cleaning. Before Cleaning I am trying to save it in map like this Code: Copy Public Sub SaveAttributes Dim tmpAtt As TextAttributes=ActiveTXT.SaveTextAttributes curAttributes.Add(tmpAtt) Dim tmpattlist As List tmpattlist.Initialize2(curAttributes) mapID.Put(curImageID.tmpattlist) End Sub NO SUCCESS. when retrieving a List from any Key I am always getting the latest List. Narek
Erel B4X founder Staff member Licensed User Longtime User Jun 15, 2015 #4 There isn't any relation between tmpattlist and curImageID.tmpattlist. Your code just creates a list and doesn't do anything with it. Call curImageId.tmpattlist.Initialize. It will create a new list. Upvote 0
There isn't any relation between tmpattlist and curImageID.tmpattlist. Your code just creates a list and doesn't do anything with it. Call curImageId.tmpattlist.Initialize. It will create a new list.