Waldemar Lima Well-Known Member Licensed User Sep 19, 2019 #1 hello everyone ! can i manipulate a "Type" with a map or a list ? like this : B4X: Sub Process_Globals Type MyType (Name As String, Items(10) As Int)' As Map End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout1") MyType.initialize MyType.Name.put("mymapitem","1234") End Sub have a way to do this ?
hello everyone ! can i manipulate a "Type" with a map or a list ? like this : B4X: Sub Process_Globals Type MyType (Name As String, Items(10) As Int)' As Map End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout1") MyType.initialize MyType.Name.put("mymapitem","1234") End Sub have a way to do this ?
DonManfred Expert Licensed User Longtime User Sep 19, 2019 #2 Mytype is not a MAP. It is a CustomType. You can only use their properties. You defined name as as STRING and Items as an array of Int B4X: dim t as MyType t.initialize t.name = "Hans" dim items(10) as int items(0) = 1 items(2) = 2 t.Items = items Upvote 0
Mytype is not a MAP. It is a CustomType. You can only use their properties. You defined name as as STRING and Items as an array of Int B4X: dim t as MyType t.initialize t.name = "Hans" dim items(10) as int items(0) = 1 items(2) = 2 t.Items = items
Jack Cole Well-Known Member Licensed User Longtime User Sep 19, 2019 #3 You can put an array in a map if that's what you're asking. B4X: Dim m as Map Dim items(10) as Int m.Initialize items(0)=1 items(1)=2 m.Put("myitem",items) Upvote 0
You can put an array in a map if that's what you're asking. B4X: Dim m as Map Dim items(10) as Int m.Initialize items(0)=1 items(1)=2 m.Put("myitem",items)
E emexes Expert Licensed User Sep 19, 2019 #4 Waldemar Lima said: can i manipulate a "Type" with a map ? Click to expand... Emulate, yes; manipulate, no. Upvote 0
Waldemar Lima said: can i manipulate a "Type" with a map ? Click to expand... Emulate, yes; manipulate, no.
Waldemar Lima Well-Known Member Licensed User Sep 20, 2019 #5 Jack Cole said: You can put an array in a map if that's what you're asking. B4X: Dim m as Map Dim items(10) as Int m.Initialize items(0)=1 items(1)=2 m.Put("myitem",items) Click to expand... can i instance a unlimited array items ? Upvote 0
Jack Cole said: You can put an array in a map if that's what you're asking. B4X: Dim m as Map Dim items(10) as Int m.Initialize items(0)=1 items(1)=2 m.Put("myitem",items) Click to expand... can i instance a unlimited array items ?
Jack Cole Well-Known Member Licensed User Longtime User Sep 20, 2019 #6 Waldemar Lima said: can i instance a unlimited array items ? Click to expand... If you want that, it would probably be better to use a list (instead of array) and a map. B4X: Dim m as Map Dim L as List m.Initialize L.Initialize L.Add(1) L.Add(2) m.Put("myitem",L) Upvote 0
Waldemar Lima said: can i instance a unlimited array items ? Click to expand... If you want that, it would probably be better to use a list (instead of array) and a map. B4X: Dim m as Map Dim L as List m.Initialize L.Initialize L.Add(1) L.Add(2) m.Put("myitem",L)