B4J Question [SOLVED]Updating multiple Webviews on Pane

Peter Lewis

Active Member
Licensed User
Longtime User
Hi
I have created 18 Webviews on a Pane which I cave proved that they are there by Getting Nodes on the Pane

This is how I created the Grid

B4X:
Sub creategrids (NumberOfColumns As Int , NumberOfRows As Int)
pnlimageshow.RemoveAllNodes
    Dim gap As Int = 5dip
    
    Dim wvWidth As Int = 140
    Dim wvHeight As Int = 140

    For x = 0 To NumberOfRows -1
        For y = 0 To  NumberOfColumns -1
            Dim wvImg As WebView
            wvImg.Initialize("wvImg")
            pnlimageshow.AddNode((wvImg),y * (wvWidth+gap), x * (wvHeight+gap), wvWidth, wvWidth)
        Next
    Next
    Log("grid created")
    
End Sub

I then have another sub that fills this pane with Pictures (Hence using Webview. I tested with ImageView with local pictures and it worked perfectly) which are online. I generated the URLs from the MYSQL DB and tested them and they all work. The following Sub populates the WebView with the URL

B4X:
Sub addimagess(id_product As String)
            Dim query4 As String = $"
                        SELECT    pi.id_product
                                , pi.id_image
                                , pi.position
                                , pi.cover
                                
                        from pss_product as pp
                        INNER JOIN pss_image as pi on pi.id_product = pp.id_product
                        where pp.id_product = ?
                        order by pi.position
                    "$
            Dim imgs As dataTable
                imgs.Initialize(sql2,query4,Array As String(id_product))
            Dim url(20) As String
        
            Dim pics As WebView
                pics.Initialize("pics")
    
    For x = 0 To imgs.RowsCount-1
        Dim abc As Pane= pnlimageshow
            Dim lineinfo() As String =imgs.getRowValues(x)
            Dim pic(20) As String
            Dim digits As Int = 0
            Dim product_id_url As String
            
        For p = 0 To lineinfo(1).Length - 1
            digits = digits + 1
            pic(p)=(sua.Substring(lineinfo(1),p,p+1))
        Next

            Select digits
                Case 2
                    product_id_url="https:\\www.justleds.co.za/img/p/"&pic(0)&"/"&pic(1)&"/"&lineinfo(1)&"-cart_default.jpg"
                Case 3
                    product_id_url="https:\\www.justleds.co.za/img/p/"&pic(0)&"/"&pic(1)&"/"&pic(2)&"/"&lineinfo(1)&"-cart_default.jpg"
            End Select
        
            url(x) = product_id_url

            pics=abc.GetNode(x) 
            pics.LoadUrl(url(x))

                Log("Node "&x&" - "&abc.GetNode(x+1))
                Log("URLs "&url(x))
    Next
    
End Sub

The log is as follows

Cat product Networking
grid greated
Node 0 - (WebView) WebView@632a5697[styleClass=web-view]
URLs https:\\www.justleds.co.za/img/p/9/5/95-cart_default.jpg
Node 1 - (WebView) WebView@4bcd2b27[styleClass=web-view]
URLs https:\\www.justleds.co.za/img/p/9/7/97-cart_default.jpg
Node 2 - (WebView) WebView@49102338[styleClass=web-view]
URLs https:\\www.justleds.co.za/img/p/9/6/96-cart_default.jpg

but the screen output remains blank, The has to be something I am missing . I have tried multiple ways for the past few hours but just cannot find where I went wrong

1726431971507.png



Any Direction of what I am missing would help.

Thank you
 
Top