faholet540
Member
Hello everyone, i have a problem with the clv...
im doing this to fill the clv and works perfect
but when i need read all clv items to search which item is checked i get this error:
java.lang.RuntimeException: Object should first be initialized (View).
the error i get in this line: Dim chk As CheckBox = p.GetView(3)
the view 3 is the checkbox
I have this in a button:
Thanks all
Regards
im doing this to fill the clv and works perfect
B4X:
clv_cob_referencias.Clear
clv_cob_referencias.Add(CreateItemCO("dadadagr", "01/01/2020", "256.58"), refer)
clv_cob_referencias.Add(CreateItemCO("hfththfthfth", "02/01/2020", "56.58"), refer)
clv_cob_referencias.Add(CreateItemCO("sser54egdgdgr", "03/01/2020", "1256.58"), refer)
clv_cob_referencias.Add(CreateItemCO("jyjgtrgse", "04/01/2020", "22346.58"), refer)
clv_cob_referencias.Add(CreateItemCO("drhgdrgdr", "05/01/2020", "255.8"), refer)
clv_cob_referencias.Add(CreateItemCO("dadawdawdaw", "06/01/2020", "2.58"), refer)
clv_cob_referencias.Add(CreateItemCO("dadadagr", "01/01/2020", "256.58"), refer)
clv_cob_referencias.Add(CreateItemCO("hfththfthfth", "02/01/2020", "56.58"), refer)
Private Sub CreateItemCO(refer As String, fecha As String, impo As String) As Panel
Dim p As B4XView = xui.CreatePanel("")
Dim height As Int = 110dip
If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 110dip
p.SetLayoutAnimated(0, 0, 0, clv_cob_referencias.AsView.Width, height)
p.LoadLayout("verrefer")
p.Tag = refer
lbl_cobr_desc1.Text = refer
lbl_cobr_desc2.Text = fecha
lbl_cobr_desc3.Text = impo
chk_cobr_esta.Tag = impo
lbl_cobr_desc1.TextSize = TextSizes
lbl_cobr_desc2.TextSize = TextSizes
lbl_cobr_desc3.TextSize = TextSizes
Return p
End Sub
but when i need read all clv items to search which item is checked i get this error:
java.lang.RuntimeException: Object should first be initialized (View).
the error i get in this line: Dim chk As CheckBox = p.GetView(3)
the view 3 is the checkbox
I have this in a button:
B4X:
Sub btn_cobr_prueba_Click
For i = 0 To clv_cob_referencias.GetSize - 1
Dim p As Panel = clv_cob_referencias.GetPanel(i)
Dim chk As CheckBox = p.GetView(3)
If chk.Checked Then
Log("checked...")
End If
Next
End Sub
Thanks all
Regards