B4J Question How do I Get Checkbox a Trap in Tableview

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All
I have tableview loaded with data from a SQLite Database. No problem, added the extra Field in the Database as Integer

Then ran this code which allows me to have the checkbox and I can change the value on screen

B4X:
Dim m As Map
    m.initialize
    m.put(0,"Checkbox") ' columnIndex and node to add
      
    DBUTILS.ExecuteTableView3(sql1,"select Checkbox,Name, Cellular, Loginname from friends",Null,0,TableFriends,m)

I also have a Checkbox that I have put on the screen for Select all , That works well and I can trap when it is done and update the database no problem , here is the code

B4X:
Sub CheckBox1_CheckedChange(Checked As Boolean)
    If Checked = True Then
        For Each r() As Object In TableFriends.items
            Dim cb As CheckBox = r(0)
            cb.checked = True
            Log("checked")
        Next
    Else
        For Each r() As Object In TableFriends.items
            Dim cb As CheckBox = r(0)
            cb.checked = False
            Log("Unchecked")
        Next
    End If
    Log(cb.Checked)
End Sub

Now I am trying to trap when one of the checkboxes on the Tableview is checked so that I can update the database with just that one record or possible a few records

I have tried multiple things that I though would work but has not yet to date.

If you have any suggestions , please

Thank you
 
Top