B4J Question Busy indicator while webview loads?

Discussion in 'B4J Questions' started by tsteward, Jun 20, 2015.

Similar threads

B4J Tutorial FlickrViewer
B4J Tutorial Modal dialogs
B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For
B4A Class [class][B4X] Google OAuth2
Other B4X Push Server
  1. tsteward

    tsteward Active Member Licensed User

    How can I get a busy/progrss indicator to show while website loads. I have tried below without success.
    ProgressIndicator was created in designer.

    Code:
    'Class module
    Sub Class_Globals
        
    Private fx As JFX
        
    Private frm As Form
        
    Private VINWV As WebView
        
    Private msgbox As Msgboxes
        
    Private VINCombo As ComboBox
        
    Private myUrl As String
        
    Private ProgInd As ProgressIndicator
    End Sub

    'Initializes the object. You can add parameters to this method if needed.
    Public Sub Initialize
        frm.Initialize(
    "frm"800700)
        frm.Resizable = 
    False
        frm.Title = 
    "VIN Decoder"
        frm.RootPane.LoadLayout(
    "VIN")
    End Sub
    Public Sub Show
        VINCombo.Items.Add(
    "Generic")
        VINCombo.Items.Add(
    "Ford")
        VINCombo.Items.Add(
    "Toyota")
        VINCombo.Items.Add(
    "RTA VIC")
        VINCombo.Items.Add(
    "RTA Tas")
        VINCombo.Items.Add(
    "RTA NSW")
        VINCombo.Items.Add(
    "RTA NT")
        VINCombo.Items.Add(
    "RTA ACT")
        VINCombo.Items.Add(
    "RTA Qld")
        
    If Main.MakeCombo.SelectedIndex > -1 Then
            
    If Main.MakeCombo.Value = "Ford" Then
                VINCombo.SelectedIndex = 
    1
            
    Else If Main.MakeCombo.Value = "Toyota" Then
                VINCombo.SelectedIndex = 
    2
            
    Else
                VINCombo.SelectedIndex = 
    0
            
    End If
        
    Else
            VINCombo.SelectedIndex = 
    0
        
    End If
        frm.ShowAndWait
        VINWV.LoadHtml(
    "")
    End Sub
    Sub VINWV_PageFinished (Url As String)
        ProgInd.Visible = 
    False
    End Sub
    Sub VINCombo_SelectedIndexChanged(Index As Int, Value As Object)
        
    Select Value
            
    Case "Generic"
                myUrl = 
    "http://www.vindecoder.net"
            
    Case "Ford"
                myUrl = 
    "http://www.etis.ford.com/vehicleSelection.do"
            
    Case "Toyota"
                myUrl = 
    "http://www.toyodiy.com/parts/q.html"
            
    Case "RTA VIC"
                myUrl = 
    "http://vre.vicroads.vic.gov.au/TermsAndConditions.aspx"
            
    Case "RTA Tas"
                myUrl = 
    "https://www.transport.tas.gov.au/MRSWebInterface/public/regoLookup/registrationLookup.jsf"
            
    Case "RTA NSW"
                myUrl = 
    "https://www.myrta.com/wps/portal/extvp/myrta/rego/check-reg-history/!ut/p/b1/hZDJkoJADIafxSfoxkaWI9KNwIggO32xGECWYVGGQeHpB62ao2NOSepL8v8BFESMuOaQsFlDBEJA23gs83gouzauHzXlTlAllu-teQY6Gge1reebvoSYHWIXIHoAL0KC7-YDEEL25FTCxZiGcD_Lo1vNzmTgBBozQUavQUN0rdS3va2EFSG7jUAHNCmy5MvO8vJ76J9a1SXr-mnZR_89qfJvAA79Aa89HdSuyUC0YPxrbxvgglBJch53Uk6kUNrx5H4oeIm5RMTstDFJ0CTH84eQepdinjeGeC8a5RrLg0Pchiv7ufbZpORqm5Hd4UcZZ3MXfFOM69beS5yZF14c4GtNPXYc7Gg93Fard6L4h6jnw5FmyBZmUkQOQphO6ZkYeNzeK9VmYCRCGelMdRSXfmalJ3pLz5_BduoM3JLDUTH9ps6coHCC5rKjrW5dv-qr0-i12-ti78WsJumfftXAFWhovd_o5IzD-fgLrkdxBA!!/"
            
    Case "RTA NT"
                myUrl = 
    "http://www.transport.nt.gov.au/mvr/rego-check"
            
    Case "RTA ACT"
                myUrl = 
    "http://www.rego.act.gov.au/payments-and-more/check-registration-details"
            
    Case "RTA Qld"
                myUrl = 
    "https://www.service.transport.qld.gov.au/checkrego/application/VehicleSearch.xhtml?windowId=cdc"
        
    End Select
        ProgInd.Visible = 
    True
        VINWV.LoadUrl(myUrl)
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Your code looks correct. In which way doesn't it work?
     
Loading...