Header.AddView(L, Left, 0, w, cRowHeight)
Header.AddView(L, Left, 0, w, cHeaderHeight)
I found another bug in this class but this one I can't fix.
Maybe some one can help
Bug description: Can't select the last row(s)
Occurs when
1) cHeaderHeight > ± 1,6 x cRowHeight AND
2) the number of rows in the table is so small that vertical scroll isn't possible / needed
In the attached file I've set cRowHeight to 25 and cHeaderHeight to 50
In this case it's not possible to select the last row (= row 1)
If you set cRowHeight to 25 and cHeaderHeight to 75 isn't possible to select the last two rows (row 0 and row 1)
Any help is welcome
Henk
internalPanel.Top = Data.Size * cRowHeight + cRowHeight
internalPanel.Top = Data.Size * cRowHeight + cHeaderHeight
LoadRDCResult(DBResult.Columns, DBResult.Rows, True)
'load data from a RDC Request
'A RDC request returns a DBResult object, therefore this method
'could be called as is:
'LoadRDCResult(DBResult.Columns, DBResult.Rows, True)
'AutomaticWidths True > set the column widths automaticaly
'Written by LucasMs
Public Sub LoadRDCResult(Columns As Map, Rows As List, AutomaticWidths As Boolean)
cAutomaticWidths = AutomaticWidths
NumberOfColumns = Columns.Size
innerClearAll(NumberOfColumns)
Dim Headers(NumberOfColumns) As String
Dim ColumnWidths(NumberOfColumns) As Int
Dim HeaderWidths(NumberOfColumns) As Int
Dim DataWidths(NumberOfColumns) As Int
Dim col, row As Int
Dim str As String
For col = 0 To NumberOfColumns - 1
Headers(col) = Columns.GetKeyAt(col)
If AutomaticWidths = False Then
ColumnWidths(col) = 130dip
HeaderWidths(col) = 130dip
DataWidths(col) = 130dip
Else
HeaderWidths(col) = cvs.MeasureStringWidth(Headers(col), Typeface.DEFAULT, cTextSize) + 8dip + cLineWidth
DataWidths(col) = 0
Dim FieldValue As Object
For row = 0 To Rows.Size - 1
Dim Record() As Object = Rows.Get(row)
FieldValue = Record(col)
If GetType(FieldValue) = "java.lang.String" Then
DataWidths(col) = Max(DataWidths(col), cvs.MeasureStringWidth(str, Typeface.DEFAULT, cTextSize) + 8dip + cLineWidth)
End If
Next
ColumnWidths(col) = Max(HeaderWidths(col), DataWidths(col))
End If
Next
SetHeader(Headers)
SetColumnsWidths(ColumnWidths)
For Each Record() As Object In Rows
Dim R(NumberOfColumns) As String
Dim FieldV As String
For col = 0 To NumberOfColumns - 1
FieldV = Record(col)
R(col) = FieldV
Next
AddRow(R)
Next
End Sub
Sub Table1_celllongClick (Col As Int, Row As Int)
Dim t As String
Activity.Title = Table1.GetValue(Col, Row)
Dim Row2 As Int = Row+1
Dim Listofmaps As List
Listofmaps.Initialize
Dim m As Map
m.Initialize
m=DBUtils.Executemap(SQL1,"Select * FROM LoadedT WHERE ROWid = "&Row2, Null)
t= m.Get("tname")
Listofmaps.Add(m)
DBUtils.InsertMaps(SQL1,"UnloadedT",Listofmaps) 'and put in new data
DBUtils.DeleteRecord(SQL1,"LoadedT",m)
'Table1.RemoveRow(Row2)
FillTableLT
Sub FillTableLT
' Table1.ClearAll
Table1.Initialize(Me, "Table1", 3, Gravity.CENTER_HORIZONTAL, True)
Table1.CellAlignment = Bit.OR(Gravity.center, Gravity.CENTER_VERTICAL)
Table1.HeaderColor = Colors.BLACK
Table1.HeaderTextColor = Colors.White
Table1.TextColor = Colors.white
Table1.TableColor = Colors.Gray
Table1.RowHeight = 50dip
Table1.RowColor1 = Colors.Gray
Table1.RowColor2 = Colors.LightGray
Table1.SelectedCellColor = Colors.blue
Table1.SelectedRowColor = Colors.Blue
' Table1.AllowSelection = True
Table1.AddToActivity(panel1, 0, 0, panel1.Width, panel1.Height)
' Table1.MultiSelect = True
Table1.MultiSelect = False
Table1.SortColumn = False
Table1.SingleLine = False
' Table1.SetAutomaticWidths
Dim Query As String
' Table1.ClearAll
Table1.LineWidth = 2dip
Table1.TextSize = 14
' Dim tf() As Typeface
' tf = Array As Typeface(Typeface.DEFAULT, Typeface.DEFAULT_BOLD, Typeface.DEFAULT, Typeface.DEFAULT_BOLD, Typeface.DEFAULT)
' Table1.SetTypeFaces(tf)
Query = "SELECT * FROM " & "LoadedT"
Table1.LoadSQLiteDB(SQL1, Query, True)
Table1.SetColumnsWidths(Array As Int(20%x, 35%x, 45%x))
End Sub
The error message says :
(Map) Not initialized
java.lang.RuntimeException: Object should first be initialized (Map).
This means that you are using a Map which is not initialized.
This is not related to the Table Class.