B4J Question CustomListView

moore_it

Well-Known Member
Licensed User
Longtime User
Hi all,

it's possible to check the double click in customlistview_itemclick ?
Thanks in advice
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can always handle the mouse click yourself:
B4X:
Sub Process_Globals
   Private MainForm As Form
   Private xui As XUI
   Private CustomListView1 As CustomListView
   Private ClickIndex As Int
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.RootPane.LoadLayout("1") 'Load the layout file.
   MainForm.Show
   For i = 1 To 100
       Dim p As B4XView = xui.CreatePanel("p")
       p.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, 50dip)
       p.Color = Rnd(0xff000000, -1)
       CustomListView1.Add(p, "")       
   Next
End Sub

Sub p_MouseClicked (EventData As MouseEvent)
   ClickIndex = ClickIndex + 1
   Dim MyIndex As Int = ClickIndex
   EventData.Consume
   Sleep(200)
   If MyIndex = ClickIndex Then
       If EventData.ClickCount = 1 Then
           Log("regular click")
       Else if EventData.ClickCount > 1 Then
           Log("Double click")
       End If
   End If
End Sub
 
Upvote 0
Top