CustomListView access to elements

Johnmcenroy

Active Member
Licensed User
Longtime User
Hello
I have the following code of CustomListView:

B4X:
Sub ScrollCarols_CreateList
    clvScroll.Initialize(Me, "clv2")
   pnlScroll.AddView(clvScroll.AsView, 0, 0, pnlScroll.Width, pnlScroll.Height)
   List1 = File.ReadList(File.DirAssets, "Carols.txt")
    For i = 0 To List1.Size - 1
      clvScroll.Add(CreateListItem(List1.Get(i), clvScroll.AsView.Width, 50dip), 50dip, List1.Get(i))
    Next
End Sub

Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
   Dim p As Panel
   p.Initialize("")
   p.Color = Colors.ARGB (0,255,255,255) 
   Dim chk As CheckBox
   chk.Initialize("chkScroll")
   chk.Color = Colors.ARGB (200,255,69,0)
   Dim lbl As Label
   lbl.Initialize("lblScroll")
   lbl.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.LEFT)
   lbl.Text = Text
   lbl.Typeface = Typeface.DEFAULT_BOLD
   lbl.TextSize = 17
   lbl.TextColor = Colors.RGB (255,69,0)
   Dim img As ImageView
   img.Initialize ("imgScroll")
   img.Color = Colors.ARGB (0,255,255,255)
   img.Gravity = Gravity.FILL
   For i=0 To WidgetService.YouTubeMap.Size -1
    If Text = WidgetService.YouTubeMap.GetKeyAt(i) Then
      img.Bitmap = LoadBitmap (File.DirAssets,"64.png")
      Exit
    End If
   Next
   p.AddView(chk, 0dip, 2dip, Height - 16dip, Height - 4) '0
   p.AddView(lbl, 45dip, 2dip, 220dip, Height - 4dip)     '1
   p.AddView(img, 265dip, 2dip, 50dip, Height - 4dip)     '2
   Return p
End Sub

How can i after creation of CustomListView get access to parameters of chk , something like in this pseudo code :

B4X:
For i = 0 To 'CustomListView.NumberOfViews -1
   'IF CustomListView element is Checkbox Then
           'Get parameter of Checkbox (True or False)    
Next

Thanks
 
Last edited:
Top