Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
'Crea una lista
For i = 0 To 10
clvSoci.Add(CreaRigaCLVSoci("Nome-" & i,False), "")
Next
End Sub
Sub CreaRigaCLVSoci(nome As String, checked As Boolean) As Panel
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated(0, 0, 0, clvSoci.AsView.Width, 50dip)
pnl.LoadLayout("layPartecipante")
lblNome.Text = nome
ChkNome.Checked=checked
Return pnl
End Sub
Sub chkNome_CheckedChange(Checked As Boolean)
Dim index As Int = clvSoci.GetItemFromView(Sender) <=== 'qui da errore di oggetto non inizializzato quando eseguo 'btnAggiungi'
Dim pnl As B4XView = clvSoci.GetPanel(index)
Dim lbl As B4XView = pnl.GetView(0)
clvSoci.AsView.BringToFront
If Checked Then
lbl.TextColor=Colors.RGB(70,134,208)
Else
lbl.TextColor=Colors.RGB(0,0,0)
End If
End Sub
Sub btnAggiungi_Click
clvSoci.Add(CreaRigaCLVSoci("Nome Aggiunto",True), "")
End Sub