Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
Dim Index As Int = B4XTable1.VisibleRowIds.IndexOf(RowId)
SetRowColor(Index)
LastSelection = Index
'more code .............................
End Sub
Sub SetRowColor(RowIndex As Int)
'recolor previous selection
Dim clr As Int
If LastSelection Mod 2 = 0 Then
clr = B4XTable1.EvenRowColor
Else
clr = B4XTable1.OddRowColor
End If
For Each c As B4XTableColumn In B4XTable1.VisibleColumns
Dim pnl As B4XView = c.CellsLayouts.Get(LastSelection+ 1) '+1 because of the header
pnl.Color = clr
Next
'color current selected row
For Each c As B4XTableColumn In B4XTable1.VisibleColumns
Dim pnl As B4XView = c.CellsLayouts.Get(RowIndex + 1) '+1 because of the header
pnl.Color = SelectionColor
Next
End Sub