B4J Question Tableview & retrieve data

kelvo01

Member
Licensed User
I have a tableview populated by dbutils
I want the selected row values to use ...

Sub tableview_SelectedRowChanged(Index As Int, Row() As Object)
Dim s As String
If Index = -1 Then Return
s=Row(0)
Log(s) 'id is the first column
End Sub

output AnchorPane@6fabf74c instead of the data, WHY?
 

Daestrum

Well-Known Member
Licensed User
It would appear (just a guess) the data is from a TableView/Node that is stored into the database. The problem is the source has the field you want inside an AnchorPane.
The TableView will display correctly but getting Row(0) will only display the data reference.

You will need to use code like below (depending on how the item is set up), this example assumes a label in an anchorpane
B4X:
Sub tableview_SelectedRowChanged(Index As Int, Row() As Object)
...
Dim tmpAnchorPane As Anchorpane = Row(0)
Dim tmpLabel As Label = tmpAnchorPane.getNode(0)
'show the actual data
Log(tmpLabel.Text)
...
 

kelvo01

Member
Licensed User
Thanks ford for me i need the first two columns

B4X:
Sub caricaTv_SelectedRowChanged(Index As Int, Row() As Object)
    Dim tmpAnchorPane As AnchorPane = Row(0)
    Dim tmpLabel0 As Label = tmpAnchorPane.getNode(0)

    Dim tmpAnchorPane As AnchorPane = Row(1)
    Dim tmpLabel1 As Label = tmpAnchorPane.getNode(0)

    Log(tmpLabel0.Text)
    Log(tmpLabel1.Text)
    
End Sub
I need to add the dblclick mouse .... how?
 
Top