Android Question using preoptimize custome list view how to get a click on the image?

omarruben

Active Member
Licensed User
Longtime User
I am using this samples :

how to capture a click on any image?
 

omarruben

Active Member
Licensed User
Longtime User
as far as I go:

B4X:
Sub panel1_click
    Dim i As Int = CustomListView1.GetItemFromView(Sender)
    Dim d As MyImageData = CustomListView1.GetValue(i)
    Dim indexfile As Int
    indexfile = d.IndexOfFirstImage
    Log("clicked " & indexfile)
   
   
End Sub

Sub panel2_click
    Dim i As Int = CustomListView1.GetItemFromView(Sender)
    Dim d As MyImageData = CustomListView1.GetValue(i)
    Dim indexfile As Int
    indexfile = d.IndexOfFirstImage+1
    Log("clicked " & indexfile)
End Sub

Sub panel3_click
    Dim i As Int = CustomListView1.GetItemFromView(Sender)
    Dim d As MyImageData = CustomListView1.GetValue(i)
    Dim indexfile As Int
    indexfile = d.IndexOfFirstImage+2
    Log("clicked " & indexfile)
End Sub

Sub panel4_click
    Dim i As Int = CustomListView1.GetItemFromView(Sender)
    Dim d As MyImageData = CustomListView1.GetValue(i)
    Dim indexfile As Int
    indexfile = d.IndexOfFirstImage+3
    Log("clicked " & indexfile)
End Sub

is this the right solution ?
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Check the layout and the click event.

B4X:
Private Sub Panel_MouseClicked (EventData As MouseEvent)
    Log(Sender.As(B4XView).GetView(1).Text)
End Sub

1644276854103.png
1644276907988.png
 

Attachments

  • B4JProject.zip
    5.2 KB · Views: 78
Upvote 0
Top