Public Sub CreateItem (Numero As Int, Penalita As Int, TestoPen As String)
Dim p As B4XView = xui.CreatePanel("") 'Crea il pannello su cui caricare il layout per l'item da aggiungere alla CLV
p.SetLayoutAnimated(0, 0, 0, clvListaPen.AsView.Width, 60dip) 'Imposta le dimensioni del pannello. 60Dip è l'altezza del layout dell'item nel Designer
p.LoadLayout("item") 'Carica il layout dell'item
LblNumero.SetColorAndBorder(xui.Color_Black , 2dip , xui.Color_Yellow , 100dip) 'Imposta i colori e i bordi della EditText dell'item
lblPenalita.SetColorAndBorder(xui.Color_White, 2dip, xui.Color_Black,50dip )
LblNumero.TextColor = xui.Color_Yellow
LblNumero.Text = Numero
lblPenalita.Text = Penalita
lblTestoPen.Text = TestoPen 'Scrive il crono ricevuto nella Label dell'item
clvListaPen.Add(p, Swipe.CreateItemValue("", Array("Delete")) ) 'Aggiunge l'item alla CLV
End Sub
Sub Swipe_ActionClicked (Index As Int, ActionText As String)
Log($"Action clicked: ${Index}, ${ActionText}"$)
If ActionText = "Delete" Then
Dim p As B4XView = clvListaPen.GetPanel(Index)
Dim lbl As B4XView = p.GetView(0)
clvListaPen.RemoveAt(Index)
End If
End Sub