Android Question [Solved] Label in a panel with CLV not able to access

AndroidMadhu

Active Member
Licensed User
Hello,
I am not able to access a Label in a panel with CLV. If we remove the panel from the layout then I can access the label.
Below is my code :
B4X:
Sub clvBarcode_ItemLongClick (Index As Int, Value As Object)
Dim item As CLVItem = clvBarcode.GetRawListItem(Index)
Dim p As Panel=item.Panel.GetView(0)

Dim lbl4 As Label=p.GetView(3)

Msgbox2Async("Do you want to delete?", "Delete Item", "Yes", "No", "", Null, False)
Wait For MsgBox_Result (iResult As Int)
If iResult = DialogResponse.POSITIVE Then
Log("Deleted row/"& lbl4.Text)
Private Query As String
Query = "delete from barcode_details where barcodeId='" & lbl4.Text & "'"
SQL1.ExecNonQuery(Query)
ShowBarcode
End If
End Sub

Please advice

Thanks
 

Mahares

Expert
Licensed User
Longtime User
Please advice
It will help to show the code that worked for you when you removed the panel. What would also help is a snapshot of the views tree before your removed the panel to see how the hierarchy of views stacks up.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Below is my code :
I don't know where you disappeared @AndroidMadhu, but I made an educated guess and had a feeling the below code can take care of your problem, although it is useful to know the hierarchy of your views. It is best not to make people that want to help you guess, so you do not go back and forth with a multitude of posts:
B4X:
Sub clvBarcode_ItemLongClick (Index As Int, Value As Object)
    Dim item As CLVItem = clvBarcode.GetRawListItem(Index)
    Dim p As Panel=item.Panel.GetView(0).GetView(0)
    Dim lbl4 As Label=p.GetView(3)

    Msgbox2Async("Do you want to delete?", "Delete Item", "Yes", "No", "", Null, False)
    Wait For MsgBox_Result (iResult As Int)
    If iResult = DialogResponse.POSITIVE Then
        Log("Deleted row/"& lbl4.Text)
        Dim Query As String
        Query = "delete from barcode_details where barcodeId = ?"         
        SQL1.ExecNonQuery2(Query, Array As String(lbl4.Text))
        ShowBarcode
    End If
End Sub
 
Upvote 0

AndroidMadhu

Active Member
Licensed User
I made an educated guess and had a feeling the below code can take care of your problem,
Yes...... @Mahares ..... It resolved the issue.
The below code works for me:
==============================
B4X:
Dim item As CLVItem = clvBarcode.GetRawListItem(Index)
    Dim p As Panel=item.Panel.GetView(0).GetView(0)
    Dim lbl4 As Label=p.GetView(3)

Thanks again for the support.

Thanks
 
Upvote 0
Top