Dear All,
I have a customlistview which adds each item as a panel, and I need to capture click and longclick events on these, with various results depending on which panel is clicked.
A few lines to clarify my setup:
As you can see I added a tag on the panel, but I´ve realized that since in the click and longclick events there´s no index, of course the tag will always contain only the last item added.
Does anybody have an idea of how this can be elegantly solved?
Thanks in advance!
I have a customlistview which adds each item as a panel, and I need to capture click and longclick events on these, with various results depending on which panel is clicked.
A few lines to clarify my setup:
B4X:
clv_contacts.Add(CreateListItem_contactlist(ct,clv_contacts.AsView.Width,50dip), 50dip, ct)
B4X:
Sub CreateListItem_contactlist(ct As Contactentries, itemWidth As Int, itemheight As Int) As Panel
Dim p As Panel
p.Initialize("")
Activity.AddView(p, 0, 0, itemWidth, itemheight)
p.LoadLayout("contacts_cellItem")
p.RemoveView
contact_Label.Text = ct.contact_Name
contact_Label.Tag = ct.contact_Name
contact_imgpanel.Width = contact_image.Width
contact_imgpanel.height = contact_image.height
Dim cdw As ColorDrawable
Return p
End Sub
As you can see I added a tag on the panel, but I´ve realized that since in the click and longclick events there´s no index, of course the tag will always contain only the last item added.
Does anybody have an idea of how this can be elegantly solved?
Thanks in advance!