Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.white
Dim btn As Button
btn.Initialize("button") 'all buttons click events will be handled with Sub Button_Click
Dim lbl As Label
lbl.Initialize("")
lbl.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.LEFT)
lbl.Text = Text
lbl.TextSize = 20
lbl.TextColor = Colors.Black
btn.Tag = ButtonCode1
p.AddView(lbl, 5dip, 2dip, 150dip, Height - 4dip) 'view #0
p.AddView(btn, 75%x, 2dip, 25%x, Height - 4dip) 'view #1
Return p
End Sub