I want to use a table view for showing incoming message from the server. It seems like a good tool to use, has alot of formatting controls etc all built in. Here is my code and here are questions.
1. I want the new message to be at the top of the view. I know I can sort the column by clicking on the header, but can I do it in code? So what I would do is insert the row and then get it to sort by time for the user so the newest message is always at the top.
2. I only want to have three columns, so doing this OpTableView1.SetColumnVisible(3) etc doesn't seem practical, how would I just have three?
3. the third column it would be nice to have the size of it be the remaining percentage of the table view window.
thanks in advance,
Brad
IslandMedic, Yesterday at 2:32 PM
B4X:
'setup the table view for messaging
OpTableView1.SetColumns(Array As String("Time","Sender","Message"))
OpTableView1.SetColumnSortable(0,True) 'can sort by time
OpTableView1.SetColumnSortable(1,True) 'can sort by sender
OpTableView1.SetColumnSortable(2,False) 'cannot sort by message
OpTableView1.SetColumnWidth(0,60) 'fixes the time column width.
OpTableView1.SetColumnWidth(0,100) 'fixes the time column width.
Public Sub WriteMsg(msg AsString,from AsString)Dim row(3) As Object
row(0) = DateTime.Time(DateTime.Now)
row(1) = from
row(2) = msg
'add the new items OpTableView1.Items.Add(row)'sort the time column to put the newest message at the top
End Sub
1. I want the new message to be at the top of the view. I know I can sort the column by clicking on the header, but can I do it in code? So what I would do is insert the row and then get it to sort by time for the user so the newest message is always at the top.
2. I only want to have three columns, so doing this OpTableView1.SetColumnVisible(3) etc doesn't seem practical, how would I just have three?
3. the third column it would be nice to have the size of it be the remaining percentage of the table view window.
thanks in advance,
Brad
IslandMedic, Yesterday at 2:32 PM