Hi everyone! I'm stuck in getting the status of the check box in the custom list view.
The code below calls the detailsdialog.
Then calls preCreateCustList() to create the list.
In the layout "cellItems" consist of labels and a checkbox, I'm trying the code below but I'm getting error (main_checkbox1_checkedchange (java line: 622)java.lang.RuntimeException: Object should first be initialized (View).)
Any input is appreciated...thanks.
The code below calls the detailsdialog.
B4X:
Sub ShowItemdetailsDialog(ctr As Int, myList As List)
Private cntr As Int = ctr
Dim sf As Object = DetailsDialog.ShowAsync("Product list view records[" & ctr & "]", "", "Close", "", Null, False)
DetailsDialog.SetSize(100%x, 86%y)
Dim xuii As XUI
Wait For (sf) Dialog_Ready(pnl As Panel)
'--------------------------------------------Create Custom List View------------------------
pnl.LoadLayout("cellItems0") ' Description
preCreateCustList(ctr,myList)
Wait For (sf) Dialog_Result (Result As Int)
If Result = DialogResponse.CANCEL Then
Log("Close")
End If
B4X:
Sub preCreateCustList(cnt As Int, ml As List)
clv2.Clear
For i = 0 To cnt -1
Private values1 As String
values1 = ml.Get(i)
clv2.Add(CreateListItem(values1, clv2.AsView.Width, 25%y), $"Item #${i}"$)
Next
End Sub
B4X:
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As B4XView = xuii.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, Width, Height)
p.LoadLayout("cellItems")
Log("p:"& p.NumberOfViews)
Return p
End Sub
B4X:
Sub CheckBox1_CheckedChange(Checked As Boolean)
Dim index As Int = clv2.GetItemFromView(Sender)
Dim pnl As B4XView = clv2.GetPanel(index)
Dim chk As B4XView = pnl.GetView(1)
Log($"Item value: ${clv2.GetValue(index)}Check value: ${chk.Checked}"$)
End Sub
Any input is appreciated...thanks.