I have a CustomListView that contains in each panel a label and a B4XSwitch. I'm trying to get the status (on or off) of all the B4XSwitch buttons that the list contains. I tried the code:
B4X:
For i = 0 To clv.GetSize - 1
Dim p As Panel = clv.GetPanel(i)
For Each v As View In p.GetAllViewsRecursive
If v Is Label Then
Dim lbl As Label = v
selectedMarimi.Add(lbl.Text)
End If
If v Is B4XSwitch Then
Dim sw As B4XSwitch = v
selectedValues.Add(sw.Tag)
End If
Next
Next
but the line: Dim sw As B4XSwitch = v gives an error: Types do not match. How can I identify the button?
Another problem (not so disturbing) is that the list panels overlap over the list border...I was unable to set them correctly .... (see attached picture)
B4X:
Dim p As Panel
p.Initialize("")
p.Tag = i
p.SetLayout(0, 0, clv.AsView.Width, 40dip)
p.LoadLayout("itemDrawerGrafice")
In my iOS app, which I'm porting to Android/B4X, I have a custom list view, containing panels of filter options. Each one has a text view and a switch. I can easily reset all filters to the default with this code: For i = 0 To userFilter.GetSize -1 Dim p As Panel = userFilter.GetPanel(i)...
www.b4x.com
B4X:
For i = 0 To clv.GetSize - 1
Dim p As Panel = clv.GetPanel(i)
Dim lbl As Label = p.GetView(0)
Dim chk As B4XView = p.GetView(1)
Dim checked As B4XSwitch = chk.Tag
If checked.Value Then
selectedValues.Add(checked.Tag)
selectedMarimi.Add(lbl.Text)
End If
Next