Sub AdjustHeight (Obj As Label)
Dim A As StringUtils, t As Int
t = A.MeasureMultilineTextHeight(Obj, Obj.Text)
Obj.Height = t
End Sub
'Adds a row to the table
Sub AddRow(Values() As String)
If Values.Length <> NumberOfColumns Then
Log("Wrong number of values.")
Return
End If
Dim lastRow As Int, BiggestHeight As Int, Lprev, a As Label, RowHeight2, RowHeight2_1 As Int
lastRow = NumberOfRows
BiggestHeight = -1
RowHeight2_1 = RowHeight_1
If lastRow = 0 Then
RowHeight2 = 0
Else
a = GetView(lastRow - 1,0)
RowHeight2 = a.Top + a.Height + RowLineWidth
End If
For I = 0 To NumberOfColumns - 1
Dim l As Label
l.Initialize("cell")
l.Text = Values(I)
l.Gravity = Alignment
l.TextSize = FontSize
l.TextColor = FontColor
l.Color=Colors.White
Dim rc As RowCol
rc.Initialize
rc.Col = I
rc.Row = lastRow
l.Tag = rc
tbl.AddView(l, ColumnWidth * I, RowHeight2, ColumnWidth_1, RowHeight2_1)
AdjustHeight (l)
If BiggestHeight < 0 Then 'first cell
BiggestHeight = l.Height
RowHeight2_1 = BiggestHeight
Else If BiggestHeight < l.Height Then
BiggestHeight = l.Height
Lprev.Height = BiggestHeight
RowHeight2_1 = BiggestHeight
Else If BiggestHeight > l.Height Then
l.Height = BiggestHeight
End If
Lprev = l 'latest cell
Next
tbl.Height = tbl.Height + BiggestHeight + 2dip
End Sub