B4J Question How to find check value in the table.

intertech

New Member
Licensed User
Hi,
How to find check value in the table.


B4X:
#Region Project Attributes
    #MainFormWidth: 400
    #MainFormHeight: 500
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Dim TableView1 As TableView
    Dim Button1 As Button
End Sub



Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.Show
    TableView1.Initialize("Table")
    Button1.Initialize ("button")
    Button1.Text="show items are selected"
    TableView1.SetColumns(Array("Check","Value"))
    TableView1.SetColumnWidth(0,100)
    TableView1.SetColumnWidth(1,100)
    
    MainForm.RootPane.AddNode(TableView1,0,0,310,350)
    MainForm.RootPane.AddNode(Button1,5,360,170,30)
    
    For i = 0 To 10
        Dim b As CheckBox
        b.Initialize("bu")
        b.Tag=i
        TableView1.Items.Add(Array(b,i))
    Next
End Sub

Sub Button1_click
    'VB6.0 encoding
    'For i = 0 To list1.ListItems.Count
    'If list1.ListItems(i).Checked = True Then  .............
    'Next
    
    'What b4j code?
    
End Sub


THX
 

Daestrum

Expert
Licensed User
Longtime User
B4X:
Sub button_click
 'VB6.0 encoding
 'For i = 0 To list1.ListItems.Count
 'If list1.ListItems(i).Checked = True Then  .............
 'Next
   
 'What b4j code?
    For Each thing() As Object In TableView1.Items
  Dim tstChk As CheckBox = thing(0) ' col 1
  Dim value As String = thing(1) '   col 2
  If tstChk.Checked Then Log("Value "&value& " checkbox is true")
 Next
End Sub
 
Upvote 0
Top