Android Question Click in view - CLVNested

Lucas Eduardo

Active Member
Licensed User
Hello, i am trying to make a layout that have three views in each item of CLV and it's a CLVNested.

I did an example project to demonstrate that it's not working. Is there a way to do this with CLVNested ?

this is not working
B4X:
Sub Label1_Click
    Dim index As Int = clvItem.GetItemFromView(Sender)
    Log("label1: "&index)
End Sub

Sub Label2_Click
    Dim index As Int = clvItem.GetItemFromView(Sender)
    Log("label2: "&index)
End Sub
 

Attachments

Lucas Eduardo

Active Member
Licensed User
Change CallSub2 to CallSub3 and add the X parameter to the event.
B4X:
CallSub3(ScrollingCLV, "Panel" & "ClickHandler", ScrollingCLV.GetRawListItem(innerIndex).Panel, X)
Thank you for your reply, i followed your suggest and i get this error
java.lang.Exception: Sub panelclickhandler signature does not match expected signature.

What could be?
 

Lucas Eduardo

Active Member
Licensed User
I don't think so, i don't undestand where add this new parameter to panelclickhandler. Can you show me?

i tryed this, but gave me the same error
B4X:
Sub CLVItem_ItemClick (Index As Int, Value As Object, test As Int)
    Log("test: "&test)
    Log("Value: "&Value)
    Log("Index: "&Index)
End Sub
Thank you.
 
Last edited:

Lucas Eduardo

Active Member
Licensed User
You can instead store the offset in a global variable and get it inside the event sub.
I did it but i don't know how to get the correct view.
i tryed this but gave me an error.
B4X:
Dim lbl As Label = clvItem.GetPanel(Index).GetView(offset)
and
B4X:
Dim lbl As Label = clvItem.GetPanel(clvItem.FindIndexFromOffset(offset)).GetView(0)
Probably not the correct way to get the view, can you show me the correct way?

Thank you.
 
Last edited:

Lucas Eduardo

Active Member
Licensed User
clvItem.NumberOfViews
Is it the correct way to get total of NumberOfViews?
B4X:
Public Sub getNumberOfViews As Int
    Return CLV.GetPanel(0).NumberOfViews
End Sub
or should be this?
B4X:
For i = 0 To clvItem.GetPanel(0).NumberOfViews - 1
 
Top