I have CustomListView, in there I am putting X number of switches
I have another switch for "select all" (on different location on the page), so once I check it I wish all switches in CustomerListView will be either enabled or disabled
how do I make it?
I have another switch for "select all" (on different location on the page), so once I check it I wish all switches in CustomerListView will be either enabled or disabled
how do I make it?
B4X:
For i = 0 To ListCity.Size-1
Dim pnl As Panel
If pnl.IsInitialized = False Then
pnl.Initialize("")
End If
pnl.Color = Colors.LightGray
clv1.Add(CreateListItem(ListCity.Get(i), clv1.AsView.Width, 35dip,i), 35dip, i)
180dip,i), 180dip, i)
clv1.Add(pnl, 3dip, i)
Next
B4X:
Sub CreateListItem(Text As String, Width As Int, Height As Int, Num As Int) As Panel
Dim p As Panel
If p.IsInitialized = False Then
p.Initialize("")
End If
p.Color = Colors.White
Dim chk As Switch
If chk.IsInitialized = False Then
chk.Initialize("chk")
chk.Tag = Num
End If
Dim lbl As Label
If lbl.IsInitialized = False Then
lbl.Initialize("")
End If
lbl.TextAlignment = lbl.ALIGNMENT_CENTER
lbl.Font.CreateNew (10)
lbl.Text = Text
lbl.TextColor = Colors.Gray
p.AddView(lbl, 5dip, 2dip, 100dip, Height - 1dip) 'view #0
p.AddView(chk, 100dip, 2dip, 30dip, Height - 1dip) 'view #1
Return p
End Sub