Sub Activity_Create(FirstTime As Boolean)
'Create 10 items made of a button, label and checkbox.
clv3.Initialize(Me, "clv3")
Activity.AddView(clv3.AsView, 0, 0%y, 100%x, 100%y)
Dim mylist() As String = Array As String("Water", "Soda", "Bread", "Orange Juice", "Apple", "Ice Cubes", "French Fries", "Chicken", "Fish", "Milk")
Dim recData(2) As String
For i = 1 To 10
recData(0) = mylist(i -1)
recData(1) = "Label Caption # " & i
clv3.Add(CreateListItem(recData, clv3.AsView.Width, 50dip), 50dip, "This is Return Value for Clicked Item #" & i)
Next
End Sub
Sub clv3_ItemClick(Index As Int, Value As Object)
Log(Index & " = " & Value)
End Sub
Sub CreateListItem(Values() As String, Width As Int, Height As Int) As Panel '@@ Values() is the data passed from the clv3.Add(CtreateListItem .. call above
Dim p As Panel
p.Initialize("")
p.Color = Colors.Black
Dim b As Button
b.Initialize("button")
b.Text = Values(0) ' @@ the button gets the first value in the passed array ... Values()
Dim lbl As Label
lbl.Initialize("")
lbl.Text = Values(1) ' @@ the Label gets the 2nd value in the passed array ... Values()
lbl.TextSize = 16
lbl.TextColor = Colors.White
Dim chk As CheckBox
chk.Initialize("chk")
p.AddView(lbl, 5dip, 2dip, 150dip, Height - 4dip) 'view #0
p.AddView(b, 155dip, 2dip, 110dip, Height - 4dip) 'view #1
p.AddView(chk, 280dip, 2dip, 50dip, Height - 4dip) 'view #2
Return p
End Sub