'Adds a text item. The item height will be adjusted based on the text.
Public Sub AddTextItem(Text As String, Value As Object)
InsertAtTextItem(items.Size, Text, Value)
End Sub
'Inserts a text item at the specified index.
Public Sub InsertAtTextItem(Index As Int, Text As String, Value As Object)
Dim pnl As Panel
pnl.Initialize("")
Dim lbl As Label
lbl.Initialize("")
pnl.AddView(lbl, 5dip, 2dip, sv.Width - 5dip, 20dip)
Dim font As Typeface
lbl.Typeface = font.MONOSPACE
lbl.Text = Text
If DefaultTextBackground <> Null Then
pnl.Background = DefaultTextBackground
Else
pnl.Color = DefaultTextBackgroundColor
End If
Dim minHeight As Int
minHeight = su.MeasureMultilineTextHeight(lbl, Text)
lbl.Height = Max(50dip, minHeight)
InsertAt(Index, pnl, lbl.Height + 2dip, Value)
End Sub