iOS Question Adding a List to a Map

Discussion in 'iOS Questions' started by narek adonts, Jun 12, 2015.

  1. narek adonts

    narek adonts Well-Known Member Licensed User

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Create a new list each time:
    Code:
    Dim list1 As List 'same variable name, new list
    list1.Initialize
     
  3. narek adonts

    narek adonts Well-Known Member Licensed User

    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:
    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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    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.
     
Loading...