Hi All,
is it possible to intercept the double click on the B4XTable in B4J?
Thanks!
is it possible to intercept the double click on the B4XTable in B4J?
Thanks!
column = B4XTable1.AddColumn("Number Example 3", B4XTable1.COLUMN_TYPE_NUMBERS)
Dim data As List = su.LoadCSV2(File.DirAssets, "us_counties.csv", ",", headers)
B4XTable1.MaximumRowsPerPage = 20
B4XTable1.BuildLayoutsCache(B4XTable1.MaximumRowsPerPage)
For i = 1 To column.CellsLayouts.Size - 1
Dim p As B4XView = column.CellsLayouts.Get(i)
Dim Touch As B4XView = xui.CreatePanel("Touch")
Touch.Color =xui.Color_Transparent
Touch.Tag = i - 1
p.AddView(Touch, 0, 0, p.Width, p.Height)
Next
B4XTable1.SetData(data)
Sub B4XTable1_DataUpdated
For i = 1 To column.CellsLayouts.Size - 1
Dim p As B4XView = column.CellsLayouts.Get(i)
Dim Touch As B4XView = p.GetView(1)
Touch.SetLayoutAnimated(0, 0, 0, p.Width, p.Height)
Next
End Sub
Private Sub Touch_MouseClicked (EventData As MouseEvent)
Dim p As B4XView = Sender
Dim RowNumber As Int = p.Tag
Dim RowId As Long = B4XTable1.VisibleRowIds.Get(RowNumber)
If RowId > 0 Then
Dim value As String = B4XTable1.GetRow(RowId).Get(column.Id)
If EventData.ClickCount = 2 Then
Log($"Double click: ${value}"$)
Else
Log($"Single click: ${value}"$)
End If
End If
EventData.Consume
End Sub
'Put this declaration In Process Globals
'Dim WaitClick As Byte
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
If WaitClick = 1 Then
WaitClick = 2
Return
End If
WaitClick = 1
Sleep (250) 'adjust for how fast you want the Double Click/Tap to be.
If WaitClick = 1 Then
Log ("Single")
Else
Log ("Double")
End If
WaitClick = 0
end Sub