B4J Question Get value from tableview when i click on a row

antsab

Member
Licensed User
Longtime User
Hi i found this code on forum, it's good for me but the only thing miss is when i click on a row the return value.
B4X:
Sub fillTableView(Query As String)
    Log("Fill tableview")
    Dim cur As ResultSet
    cur = SQL.ExecQuery(Query)
    ' Build the tableview column headings
    Dim cols As List
    cols.Initialize
    For i = 0 To cur.ColumnCount - 1
        cols.Add(cur.GetColumnName(i))
    Next
    ' Set the tableview column headings
    TableView1.Items.Clear
    TableView1.SetColumns(cols)
    ' Adjust the column width
    Dim w As Int
    w = (TableView1.Width / TableView1.ColumnsCount) - 4
    For i = 0 To TableView1.ColumnsCount - 1 
        TableView1.SetColumnWidth(i, w)
    Next
    Do While cur.NextRow
        Dim values(cur.ColumnCount) As Object
        For col = 0 To cur.ColumnCount - 1
            values(col) = cur.GetString2(col)
        Next
        TableView1.Items.Add(values)
    Loop
    cur.Close
End Sub

Any suggestions how to manage the click event on a row and return the value of a specific field?

Thanks
 
Top