Sub CreateListItem(ToGetItemHeight As Boolean, Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
If ToGetItemHeight Then
'we need to add the panel to a parent. It will be removed after the layout is loaded.
Activity.AddView(p, 0, 0, 0, 0)
p.LoadLayout("CellItem")
mCLV2ItemHeight = Button1.Height
Else
'we need to add the panel to a parent to set its dimensions. It will be removed after the layout is loaded.
Activity.AddView(p, 0, 0, Width, Height)
p.LoadLayout("CellItem")
End If
p.RemoveView
'label1 and button1 will point to the last added views.
Label1.Text = Text
Button1.Text = "Click"
Return p
End Sub