fbritop Well-Known Member Licensed User Longtime User Jul 8, 2015 #1 Erel, Is it possible in B4I to attach an imageview to a map key? I have done it in Android but in iOS there is no chance to retrieve this image after from the map. Is there any special treament to attach an imageview to a map?. Same thing happends when I put a label. After putting any of these items, if I log the map it outputs only numeric or string values: Code: (read only map) { idProducto = 1302; isActive = 1; isDelete = 0; isDiferido = 0; isNew = 0; isOffer = 0; precio = 36900; precioFormat = "$ 36.900"; producto = "Nutra Nuggets Large Breed Puppy"; unidad = "SACO 15 KG"; }
Erel, Is it possible in B4I to attach an imageview to a map key? I have done it in Android but in iOS there is no chance to retrieve this image after from the map. Is there any special treament to attach an imageview to a map?. Same thing happends when I put a label. After putting any of these items, if I log the map it outputs only numeric or string values: Code: (read only map) { idProducto = 1302; isActive = 1; isDelete = 0; isDiferido = 0; isNew = 0; isOffer = 0; precio = 36900; precioFormat = "$ 36.900"; producto = "Nutra Nuggets Large Breed Puppy"; unidad = "SACO 15 KG"; }
omidaghakhani1368 Well-Known Member Licensed User Longtime User Jul 8, 2015 #2 Hi. I do this and dont accur error. You should be get item with type object Upvote 0
fbritop Well-Known Member Licensed User Longtime User Jul 8, 2015 #3 Erel, I figured out what happens with this problem. It seems than in B4I, when a map comes from a JSON Object it turns out automatically to a Read Only Map: JSON: {"favoritos":[{"item1", "item2", "item3"}]} ..... Code: Dim map1 As Map = JSONP.NextObject favoritos = map1.get("favoritos") Dim m as Map For i = 0 To favoritos.Size - 1 m = favoritos.Get(i) log(m) next This code execution, in the log will bring a (read only map), which I cannot "PUT" any other item into it. This disables any chance that from a CustomListView to retrieve any object that’s inside (which is an excellent method to reference any views created dynamically). After some tests, I did a small function to transform a Read Only Map to an NSMapTable Code: Sub map2Map(m As Map) As Map Dim m2 As Map m2.Initialize For Each key As String In m.keys m2.put(key,m.Get(key)) Next Return m2 End Sub Dim mProcess as Map=map2Map(m) log(mProcess) Now if we log the mProcess Map after passing it through map2map function, now it contains a writeable Map Hope it helps any lost souls with this same trouble. FBP Upvote 0
Erel, I figured out what happens with this problem. It seems than in B4I, when a map comes from a JSON Object it turns out automatically to a Read Only Map: JSON: {"favoritos":[{"item1", "item2", "item3"}]} ..... Code: Dim map1 As Map = JSONP.NextObject favoritos = map1.get("favoritos") Dim m as Map For i = 0 To favoritos.Size - 1 m = favoritos.Get(i) log(m) next This code execution, in the log will bring a (read only map), which I cannot "PUT" any other item into it. This disables any chance that from a CustomListView to retrieve any object that’s inside (which is an excellent method to reference any views created dynamically). After some tests, I did a small function to transform a Read Only Map to an NSMapTable Code: Sub map2Map(m As Map) As Map Dim m2 As Map m2.Initialize For Each key As String In m.keys m2.put(key,m.Get(key)) Next Return m2 End Sub Dim mProcess as Map=map2Map(m) log(mProcess) Now if we log the mProcess Map after passing it through map2map function, now it contains a writeable Map Hope it helps any lost souls with this same trouble. FBP