P Peter Lewis Well-Known Member Licensed User Longtime User May 2, 2020 #1 Hi All Yet again I cannot get this right and I do not know why I setup a webview and already the the initialize ect. Then I made a sub so that I can pass a parameter to it and it will load the webpage. Here is the Sub. B4X: Sub ADVERTS(startpages As String) Log("Loading "&startpages) Private startPage As String = "https://www.djpeter.co.za/advert4.jpg" we.RunMethod("load",Array As String(startPage)) Log("loaded") End Sub Now I have tried a few different ways. 1. Loading the runmethod with the variable start pages which that variable has the exact string that is shown in startpage variable . Does not work. 2. Changed to Load the Array as Object , Does not work 3. if i change it to use the variable Startpage, it works 4. I tried moving the initialize lines into this sub and no difference B4X: we.InitializeNewInstance("javafx.scene.web.WebEngine",Null) temp = WebView1 we = temp.RunMethod("getEngine",Null) This is now confusing for me , please can someone show me the light. thank you
Hi All Yet again I cannot get this right and I do not know why I setup a webview and already the the initialize ect. Then I made a sub so that I can pass a parameter to it and it will load the webpage. Here is the Sub. B4X: Sub ADVERTS(startpages As String) Log("Loading "&startpages) Private startPage As String = "https://www.djpeter.co.za/advert4.jpg" we.RunMethod("load",Array As String(startPage)) Log("loaded") End Sub Now I have tried a few different ways. 1. Loading the runmethod with the variable start pages which that variable has the exact string that is shown in startpage variable . Does not work. 2. Changed to Load the Array as Object , Does not work 3. if i change it to use the variable Startpage, it works 4. I tried moving the initialize lines into this sub and no difference B4X: we.InitializeNewInstance("javafx.scene.web.WebEngine",Null) temp = WebView1 we = temp.RunMethod("getEngine",Null) This is now confusing for me , please can someone show me the light. thank you
alwaysbusy Expert Licensed User Longtime User May 2, 2020 #2 Why don’t you just use webview1.loadUrl(StartPage)? Upvote 0
P Peter Lewis Well-Known Member Licensed User Longtime User May 2, 2020 #3 alwaysbusy said: Why don’t you just use webview1.loadUrl(StartPage)? Click to expand... Thank you Should the string have " " around it or not Upvote 0
alwaysbusy said: Why don’t you just use webview1.loadUrl(StartPage)? Click to expand... Thank you Should the string have " " around it or not
alwaysbusy Expert Licensed User Longtime User May 2, 2020 #4 if is use it directly in LoadUrl like .loadUrl("http://...") then yes. Not if it is a variable. Upvote 0
P Peter Lewis Well-Known Member Licensed User Longtime User May 2, 2020 #5 I did try that and it loads the URL the first time but in the next loop it still keeps the same URL. I checked the incoming url with a log event and it shows the new url and i cannot find anywhere to clear Webview. Sorry the previous question about the "" was stupid. Now that I have had some sleep I can see that ...LOL Upvote 0
I did try that and it loads the URL the first time but in the next loop it still keeps the same URL. I checked the incoming url with a log event and it shows the new url and i cannot find anywhere to clear Webview. Sorry the previous question about the "" was stupid. Now that I have had some sleep I can see that ...LOL
P Peter Lewis Well-Known Member Licensed User Longtime User May 2, 2020 #6 I have now made a simple app so display 5 of the pages on Webview. Even if I clear it after the first page, the rest do not appear. It does clear the first page but then nothing else displays. Attachments webviewtest.zip webviewtest.zip 1.9 KB · Views: 419 Upvote 0
I have now made a simple app so display 5 of the pages on Webview. Even if I clear it after the first page, the rest do not appear. It does clear the first page but then nothing else displays.