Hi Erel,B4X:Dim row() As Object = tv.Items.Get(<row number>) row(3) = "new value"
' To refresh the tableview (id: tableviewStandard) displayed data with any new data
Sub tableviewStandard_Refresh
' Get the selected row
Dim rs As Int = tableviewStandard.SelectedRow
' Use a temporary list which holds the updated row (cells) objects as taken from the updated tableview list
Dim tvl As List
tvl.Initialize
tvl.AddAll(tableviewStandard.Items)
' Clear all items in the tableview list
tableviewStandard.Items.Clear
' And add the objects from the list to the tableviewStandard items
For i = 0 To tvl.Size - 1
Dim r() As Object = tvl.Get(i)
tableviewStandard.Items.Add(Array As Object(r(0), r(1)))
Next
' Set the selected row
tableviewStandard.SelectedRow = rs
End Sub
Sub AddRow(tv As TableView, Row() As String)
Dim rowOfLabels(Row.Length) As Object
For i = 0 To Row.Length - 1
Dim lbl As Label
lbl.Initialize
lbl.Text = Row(i)
rowOfLabels(i) = lbl
Next
tv.Items.Add(rowOfLabels)
End Sub
This method doesn't work if you use TextField in the rows of the TableView. :-(Sub tableRefresh
Table1 .SetColumnVisible (0,False) 'Forces a table refresh
Table1 .SetColumnVisible (0,True)
End Sub
Sub Process_Globals
Private tv1 As TableView
Private TimerRefresh As Timer
End Sub
Sub AppStart (Form1 As Form, Args() As String)
TimerRefresh.Initialize("TimerRefresh", 1)
End Sub
Sub tv1StartRefresh
For i = 0 To tv1.ColumnsCount -1
tv1.SetColumnVisible(i, False)
Next
TimerRefresh.Enabled = True
End Sub
Sub TimerRefresh_Tick
For i = 0 To tv1.ColumnsCount -1
tv1.SetColumnVisible(i, True)
Next
TimerRefresh.Enabled = False
End Sub
It seems to be technically impossible to add DoEvents in B4J due to the way the internal queue is handled in JavaFX.B4J is missing a "DoEvent" like in B4A