Android Question How to control two checkboxes in the same clv row.

ProjectGroup19

Active Member
Licensed User
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

 

Attachments

  • Screenshot_20230728-215912.png
    Screenshot_20230728-215912.png
    63.7 KB · Views: 61

LucaMs

Expert
Licensed User
Longtime User
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.
 
Upvote 1
Top