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?
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)
...
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