WebBrowser page loading and setPage()

263 views
Skip to first unread message

State Thirteen

unread,
Oct 29, 2013, 4:45:04 AM10/29/13
to codenameone...@googlegroups.com
Hi,

I have two questions about WebBrowser component. 
Device - Android API 7.

1. When page are being loaded there is a "Loading" dialog appears till the page is completely loaded including images. It could take a long time.
Is there any settings to disable waiting and allow user to interact with browser while images are being loaded for example?

2. Scenario. WebBrowser content set by setPage(). User clicks on any link and goes to the new internet page. When user goes back I use setPage() again to set the right content.
When I do this there is no "Loading" dialog showed, just blank white container. If I wait few seconds the content appears. 
How to let user know that some process is running in background and he should wait for a while?


Steve Hannah

unread,
Oct 29, 2013, 12:12:09 PM10/29/13
to codenameone...@googlegroups.com
On Tue, Oct 29, 2013 at 1:45 AM, State Thirteen <rusla...@gmail.com> wrote:
Hi,

I have two questions about WebBrowser component. 
Device - Android API 7.

1. When page are being loaded there is a "Loading" dialog appears till the page is completely loaded including images. It could take a long time.
Is there any settings to disable waiting and allow user to interact with browser while images are being loaded for example?

Try calling:
Display.getInstance().setProperty("WebLoadingHidden", "true");

before you load the page.
 

2. Scenario. WebBrowser content set by setPage(). User clicks on any link and goes to the new internet page. When user goes back I use setPage() again to set the right content.
When I do this there is no "Loading" dialog showed, just blank white container. If I wait few seconds the content appears. 
How to let user know that some process is running in background and he should wait for a while?

You could show a progress indicator when you call setPage() and then hide it in the onLoad() callback ... (I think that is still fired when you use setPage()). 

Steve



--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/950ac92c-4d71-4fc2-8b4b-47aa5e714a0b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Steve Hannah
Web Lite Solutions Corp.

State Thirteen

unread,
Oct 29, 2013, 2:47:01 PM10/29/13
to codenameone...@googlegroups.com
Hi Steve,

Still having "Loading" dialog with this code.

wbPage = "<html><body>" + resp + "</body></html>";
Display.getInstance().setProperty("WebLoadingHidden", "true"); 
findMyWebBrowser(f).setPage(wbPage, "");




Steve Hannah

unread,
Oct 29, 2013, 2:58:29 PM10/29/13
to codenameone...@googlegroups.com
It looks like, on Android, it uses this property (WebLoadingHidden) in the constructor of the Web Browser peer component.   Therefore, you would have to set this property before the browser component is created.  It looks like you're using the Designer for your UI so the WebBrowser is loaded before you called this code.  I'm not sure where you have to set this property in order for it to be picked up.  Try in your StateMachine's init() method (at the beginning).  If not there, then you'll probably need to find a way to pass these in the build settings (don't know if that's possible).  Or file an RFE to make this parameter more easily configurable through the API.

This is where the property is used in the AndroidImplementation, in case you're looking at hacking on the core yourself.

The line 
hideProgress = Display.getInstance().getProperty("WebLoadingHidden", "false").equals("true");

Steve


--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/groups/opt_out.

Shai Almog

unread,
Oct 29, 2013, 3:15:35 PM10/29/13
to codenameone...@googlegroups.com
Chen just made some improvements to the behavior of the loading dialog, they aren't up on the server yet though.

State Thirteen

unread,
Oct 29, 2013, 3:20:54 PM10/29/13
to codenameone...@googlegroups.com
Steve,

Thanks for the hint.

Shai,

I am looking forward for these improvements. Thank you.

klindb...@gmail.com

unread,
Jun 18, 2014, 8:23:09 PM6/18/14
to codenameone...@googlegroups.com
Steve,

How would I get the 'wait progress' indicator mentioned in #2 for the BrowserComponent, as opposed to the WebBrowser component? There is no OnLoad() for the BrowserComponent. 

I'm having the same situation as described above, sometimes there is a long wait for the BrowserComponent setPage() to finish loading and I need some sort of 'Please wait for Load" indicator. 

While the BrowserComponent is loading, if the user clicks anything on the screen, whether app buttons or Device buttons it breaks the app since the Device browser has taken over the screen and does not allow anything else to change.

Thank you,

Ken


On Tuesday, October 29, 2013 9:12:09 AM UTC-7, shannah wrote:
On Tue, Oct 29, 2013 at 1:45 AM, State Thirteen <rusla...@gmail.com> wrote:
Hi,

I have two questions about WebBrowser component. 
Device - Android API 7.

1. When page are being loaded there is a "Loading" dialog appears till the page is completely loaded including images. It could take a long time.
Is there any settings to disable waiting and allow user to interact with browser while images are being loaded for example?

Try calling:
Display.getInstance().setProperty("WebLoadingHidden", "true");

before you load the page.
 

2. Scenario. WebBrowser content set by setPage(). User clicks on any link and goes to the new internet page. When user goes back I use setPage() again to set the right content.
When I do this there is no "Loading" dialog showed, just blank white container. If I wait few seconds the content appears. 
How to let user know that some process is running in background and he should wait for a while?

You could show a progress indicator when you call setPage() and then hide it in the onLoad() callback ... (I think that is still fired when you use setPage()). 

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

Shai Almog

unread,
Jun 19, 2014, 12:49:29 AM6/19/14
to codenameone...@googlegroups.com, klindb...@gmail.com
See the addWebEventListener() method. It can be bound to onLoad.
Reply all
Reply to author
Forward
0 new messages