Android Question Customlistview returns no item_click event

ViMeAv ICT

Member
Licensed User
Longtime User
In most cases my customlistview returns an item_click event.
But sometimes it doesn't.
I can't see the reason why it doesn't in this code.
Hopefully someone sees the problem.

customlist without itemclick:
Sub button2_Click
Dim cursor0 As Cursor
Dim i As Long
Dim sPakNr As String, sDatum As String
Dim bFound As Boolean

bFound = False
If (myCustNo.Trim.Length > 0) Then
    cursor0 = SQLDB.ExecQuery("SELECT DISTINCT ORDERS.PAKBON, ORDERS.DATUM FROM ORDERS WHERE ((ORDERS.NUMBER) = '" & myCustNo & "');")
    If (cursor0.RowCount > 0) Then
        bFound = True
        For i = 0 To cursor0.RowCount - 1
            cursor0.Position = i
            sPakNr = cursor0.GetString("PAKBON")
            sDatum = cursor0.GetString("DATUM")           
            Pakbonlist.Add(OrderItem(sPakNr, sDatum),sPakNr)
        Next
    End If
    cursor0.close
Else
    cursor0 = SQLDB.ExecQuery("SELECT DISTINCT ORDERS.PAKBON, ORDERS.DATUM FROM ORDERS;")
    If (cursor0.RowCount > 0) Then
        bFound = True
        For i = 0 To cursor0.RowCount - 1
            cursor0.Position = i
            sPakNr = cursor0.GetString("PAKBON")
            sDatum = cursor0.GetString("DATUM")
            Pakbonlist.Add(OrderItem(sPakNr, sDatum),sPakNr)
        Next
    End If
    cursor0.close
End If
If (bFound = True) Then
    Panel2.Visible = False
    Pakbonlist.asview.Visible = True
End If

End Sub

Sub OrderItem (myPakNr As String, myDatum As String) As B4XView
    Dim p As B4XView = xui.CreatePanel("Panel")
        
    p.SetLayoutAnimated(0, 0, 0,Pakbonlist.AsView.Width,Pakbonlist.AsView.Height/10)
    p.LoadLayout("Pakbon")
    
    Label20.Color = Colors.White  ''Transparent
    Label20.TextColor = Colors.black
    Label20.TextSize = 18
    Label20.Text = myPakNr

    Label21.Color = Colors.White  ''Transparent
    Label21.TextColor = Colors.black
    Label21.TextSize = 18
    Label21.Text = myDatum
    
    Return p
End Sub

Sub PakbonList_ItemClick (Index As Int, Value As Object)
    Pakbonlist.asview.Visible = False
    Panel2.Visible = True
End Sub
 

Attachments

  • pakbon.png
    pakbon.png
    45.1 KB · Views: 117
Top