Hi All,
I'm using a simple Tableview and I need to take the selected cell value. I used this code and it works perfect:
But if I change the layout of the table dragging, for example, the last column in the first position at runtime, the label shows the wrong value if I click f.e. the first item.
Is there a way to avoid this problem?
Thanks!
I'm using a simple Tableview and I need to take the selected cell value. I used this code and it works perfect:
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private TableView1 As TableView
Private Label1 As Label
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
filltable
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub filltable
TableView1.SingleCellSelection=True
TableView1.SetColumns(Array As String("Col1","Col2","Col3","Col4"))
For i=1 To 100
Dim row() As Object = Array As Object("Value C1: " & (i+10) , "Value C2: " & (i+20), "Value C3: " & (i+30),"Value C4: " & (i+40))
TableView1.Items.Add(row)
Next
End Sub
Sub TableView1_SelectedCellChanged (RowIndex As Int, ColIndex As Int, Cell As Object)
Label1.Text=Cell
End Sub
But if I change the layout of the table dragging, for example, the last column in the first position at runtime, the label shows the wrong value if I click f.e. the first item.
Is there a way to avoid this problem?
Thanks!