Bruno Ramos
Member
Hi guys, how are you? Hope fine. I want to make a supermarket product list with a xCustomList View like that
I'm going to add 10 products with 10 different maps but I don't know how to use these maps values in the different items (i made an item view with the different places where information should be), could you help me? I mean, I want to write ten different maps like this
And put this information in the different labels.
Here is my complete code
If you need more information please let me know. See you, Bruno
I'm going to add 10 products with 10 different maps but I don't know how to use these maps values in the different items (i made an item view with the different places where information should be), could you help me? I mean, I want to write ten different maps like this
B4X:
Dim newArt(5) as Map
newArt(0).Initialize
newArt(0).Put("nombre","Arroz blanco SAMAN 1kg.")
newArt(0).Put("marca","SAMAN")
newArt(0).Put("comercio","'El Vasco'")
newArt(0).Put("precio", 50)
newArt(0).Put("unidad" , 1)
And put this information in the different labels.
Here is my complete code
B4X:
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private clv As CustomListView
Private comercio As B4XView
Private imagen As B4XView
Private marca As B4XView
Private nombre As B4XView
Private precio As B4XView
Private unidad As B4XView
Dim newArt (5) As Map
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("General")
newArt(0).Initialize
newArt(0).Put("nombre","Arroz blanco SAMAN 1kg.")
newArt(0).Put("marca","SAMAN")
newArt(0).Put("comercio","'El Vasco'")
newArt(0).Put("precio", 50)
newArt(0).Put("unidad" , 1)
newArt(1).Initialize
newArt(1).Put("nombre","Harina de trigo COLOLO 0000 1kg.")
newArt(1).Put("marca","COLOLO")
newArt(1).Put("comercio","'El Vasco'")
newArt(1).Put("precio", 30)
newArt(1).Put("unidad" , 1)
Dim xui As XUI
For i =0 To 5
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(100, 1%x, 1%x, 98%x, 195dip)
p.LoadLayout("Producto_Super1")
clv.Add(p, "")
If i = 0 Then
nombre.Text = newArt(0).Get("nombre")
marca.Text ="Marca: " & newArt(0).Get("marca")
comercio.Text = "Comercio: " & newArt(0).Get("comercio")
precio.Text = "$" & newArt(0).Get("precio")
unidad.Text = newArt(0).Get("unidad") & "un."
End If
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
If you need more information please let me know. See you, Bruno