Android Question Panel Tags in CustomListView

hasexxl1988

Active Member
Licensed User
Longtime User
Hello,
I have the problem that the tag is saved when creating the CustomListView. However, with the ClickEvent on the panel, the tag is Empty

Add the CLV with this Code:
B4X:
clvList.Add(CreateListItem_Product(TagID.Text,txtPRODNAME.Text,txtPRODINFO.Text,"€ " & txtPRODPRICE.Text, 440dip, 100dip), 100dip,ID)
And this is the CLV Create Code:
B4X:
Sub CreateListItem_Product(TagPNLLEFT As String, ProduktnameLEFT As String, InfoLEFT As String, PriceLEFT As String, Width As Int, Height As Int) As Panel
    Dim p As Panel
    p.Initialize("")
    Activity.AddView(p, 0, 0, 440dip, Height)
    p.LoadLayout("Product_ListValue")
    p.RemoveView
    lblLEFTPRODName.Text = ProduktnameLEFT
    lblLEFTPRODZusatz.Text = InfoLEFT  
    lblLEFTPRODPreis.text = PriceLEFT
    pnlLEFTPROD.Tag=TagPNLLEFT
    Msgbox (pnlLEFTPROD.Tag,"TestTag")
End Sub

Sub pnlLEFTPROD_Click
    Msgbox(pnlLEFTPROD.Tag,"TAG Left")
End Sub

Result from MsgBox (On the Click Event) is Empty.

Result from Msgbox (TestTag) its OK..

Maybe someone knows a Solution :)
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Not sure if I'm missing something, but it looks like you're adding the Panel to the Activity and not the CLV?
 
Upvote 0

hasexxl1988

Active Member
Licensed User
Longtime User
What object is pnlLEFTPROD?
I think that you should use
p.Tag=TagPNLLEFT
pnlLEFTPROD is the Panel on the CustomListView.

The CustomListView has 1x Button, 1x pnlLEFTPROD and 1x pnlRIGHTPROD, and each object in the CustomListView should have its own tag.
 
Upvote 0

hasexxl1988

Active Member
Licensed User
Longtime User
I have solved the problem now that I can read the tags of each panel in the CustomListView :)

Has succeeded super working

B4X:
Sub pnlLEFTPROD_Click
Dim index As Int = clvList.GetItemFromView(Sender)
Dim pnl As Panel = clvList.GetPanel(index)
Dim pnl1 As Panel = pnl.GetView(0)

TagPNLLEFT=pnl1.Tag
End Sub

Sub pnlRIGHTPROD_Click
Dim index As Int = clvList.GetItemFromView(Sender)
Dim pnl As Panel = clvList.GetPanel(index)
Dim pnl1 As Panel = pnl.GetView(1)


TagPNLRIGHT=pnl1.Tag
End Sub
 
Upvote 0
Top