Greetings Community,
Per the attached image, there are two checkboxes in the same row. How do I make one checked whiles the other in the same row isn't.
I use the below code to uncheck all rows fields in the clv when one field is checked. How do i do same for the same row?
B4X:
For i = 0 To CustomListView1.Size - 1
' Dim pi As B4XView = CustomListView1.GetPanel(i)
Dim ll As B4XView=pi.GetView(0)
If i <> ItemIndex And ll.text = s Then
For Each v As View In pi.GetAllViewsRecursive
If v Is CheckBox Then
pi.GetView(3).Checked = False
End If
Next
End If
Next
Why not use RadioButtons? Two of them in a Panel would solve the problem automatically.
However, these CheckBoxes too in a Panel, you can take advantage of the CheckedChange event, getting CheckBox (the sender) and setting the other to the opposite value. Be careful, though, because this setting will fire the event again, so you'll need a boolean variable declared at the module level to "consume" (Exit) the unwanted event.
Writing a new function called by the CheckedChange Event, like @LucaMs wrote would do it.
Use the tag of the sender to identify the box that you want to be checked!