B4J Question How to add checkbox ?

Status
Not open for further replies.

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello,

How can I add/read checkbox column in the B4XTable?

i tried below code but it doesn't work.
B4X:
CheckColumn = B4XTable1.AddColumn("Check", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("CategoryID", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("Category", B4XTable1.COLUMN_TYPE_TEXT)
CheckColumn.Width = 160dip
CheckColumn.Searchable = False
CheckColumn.Sortable = False

Dim Data As List
Data.Initialize
Dim i As Int =0
Dim j2 As  HttpJob
j2.Initialize("", Me)
j2.PostString("http://www.sacredsensualgetaways.com/sys2906yu.php?jType=usp_CategoriesSelectWithQuery","whereSql= CategoryID >0" )
Wait For (j2) JobDone(j2 As HttpJob)
If j2.Success Then

Dim parser As JSONParser
parser.Initialize(j2.GetString)
Dim root As Map = parser.NextObject
Dim Message As String = root.Get("Message")
Dim Results As List = root.Get("Results")
For Each colResults As Map In Results
Dim row(3) As Object
row(0)="abc" ' it supposed to be checkbox
row(1) = colResults.Get("CategoryID")
row(2) = colResults.Get("Name")
Data.Add(row)
i=i+1
Next

B4XTable1.SetData(Data)
End If
j2.Release



For i = 1 To CheckColumn.CellsLayouts.Size - 1
Dim pnl As B4XView = CheckColumn.CellsLayouts.Get(i)
Dim ch As CheckBox
ch.Initialize("")
pnl.AddView(ch, 5dip, 5dip,  32dip, 32dip)
Next
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
java_Ey7VTlB379.png


Example is attached.
 

Attachments

  • B4XTable With CheckBoxes.zip
    2.4 KB · Views: 285
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
java_Ey7VTlB379.png


Example is attached.
hi
Is there a reason why this example does not compile ?
I get this error
B4J Version: 8.10
Java Version: 11
Parsing code. (0.15s)
Building folders structure. (0.08s)
Compiling code. Error
Error compiling program.
Error description: Cannot assign void value.
Error occurred on line: 627
Dim SenderFilter As Object = sql1.ExecNonQueryBatch("SQL1")
Word: )

Thank you
 
Upvote 0
Status
Not open for further replies.
Top