Android Tutorial CustomListView change textbox value

Juanll2003uy

Member
Licensed User
Longtime User
Hi i have this problem, i have a CustomListView with have: btnAdd buton, btn+ & btn- button and a txtQty textbox with quantity value (picture attached)
I need that when i press + or - button the value of textbox in the listItem change
And then when i click btnAdd_Click had the value of the textbox in this item

Customlistview:
Lista.Add(CreateListItem(bd, ElProd.Name, ElProd.Precio, Lista.AsView.Width, 120dip), ElProd.Code)
Lista.Add(CreateListItem(bd, ElProd2.Name, ElProd2.Precio, Lista.AsView.Width, 120dip), ElProd2.Code)
Lista.Add(CreateListItem(bd, ElProd3.Name, ElProd3.Precio, Lista.AsView.Width, 120dip), ElProd3.Code)

Sub CreateListItem(bmp As BitmapDrawable, name As String, prec As Double, Width As Int, Height As Int) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, Width, Height)
    p.LoadLayout("CellItem")
    lblDesc.Text=name
    lblPrecio.Text="$ " & prec
    imgFoto.Background=bmp
    btnAdd.Text="AGREGAR"
    btnAdd.Visible=Agregar
    Return p
End Sub

Private Sub btnAdd_Click
    Dim Index As Int = Lista.GetItemFromView(Sender)
end sub

Thank you very much if someone can help me
 

Attachments

  • CYMERA_20210923_203355.jpg
    238.8 KB · Views: 231

Lucas Siqueira

Active Member
Licensed User
Longtime User
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
I create a class for each row, with its own graphical interface (a panel with its controls), in which I implement all the events and functionalities. Do a loadlayout to load interface
each of these elements that I create dynamically, is added to the list and implements everything that is needed inside it.
the listview acts as a container and manages the elements.
I hope it will be useful to you
 

Unobtainius

Active Member
Licensed User
Longtime User
Without seeing any code all I can suggest is to get the button's parent panel then knowing the textbox is a child control of that panel, use the panel to get a reference to the textbox and do whatever you like with the text box
 

epiCode

Active Member
Licensed User
Why not use the following and avoid additional coding?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…