force WLoadingIndicator
Added by Ulf Johnsson 10 months ago
Hi!
I have an application that sometimes needs to display the WLoadingIndicator, for example when the client is loading the project it should display.
I can force the indicator to display by doing something like "wApp->loadingIndicator()->widget()->show()", and this works fine but it doesnt seem like the right way to do it ?
I have also read that when calling "deferRendering()" the loading indicator should be displayed automatacly, is this correct? In my application "deferRendering()" seems to have no effect :(
I'm using Wt-3.2.1
Best regards, Ulf Johnsson.
Replies (7)
RE: force WLoadingIndicator - Added by Koen Deforche 10 months ago
Hey,
The display of the loading indicator is controlled client side when a response of the server takes more than a few 100 ms time. When using deferRendering you are deferring the response until you do resumeRendering.
Are you using web sockets since there are known issues with the loading indicator not showing properly occasionally ?
Regards,
Koen
RE: force WLoadingIndicator - Added by Ulf Johnsson 10 months ago
Hi!
What I'm trying to do is the following:
In WApplication::initialize() I create a ContainerWidget that represents my view. In this containerWidget I have a "Load" method that can be called at an arbirary time, in the load method I want to do something like this:
Class CDisplay : public WContainerWidget
{
...
void Load()
{
wApp->deferRendering();
// create my graphical-objects and add them to the container...
wApp->resumeRendering();
}
};
So in summation, when my display creates its objects I want the loading indicator to show.
Best Regards,
Ulf Johnsson
RE: force WLoadingIndicator - Added by Ulf Johnsson 10 months ago
If I connect a button to do "deferRendering" it works though. The difference seems to be that if I click the button in my browser the browser sends a request to the server and expects an answer an if deferRendering is called it shows the loading indicator. However if i invoce deferRendering from some place inside my own code the browser is unaware of this...
RE: force WLoadingIndicator - Added by Ulf Johnsson 10 months ago
Is there anyway to force the client to do a request, something like:
wApp->deferRendering();
client->request(); // This would trigger the loadingindicator...
RE: force WLoadingIndicator - Added by Koen Deforche 10 months ago
Hey Ulf,
I'm not understanding what you want to happen though: could you sketch the situation in a small test case ?
Indeed the 'loading indicator' only shows when the client is waiting for a response to a request. But that is invariably the case while you are doing things server-side, unless you use a separate thread do work ?
Regards,
koen
RE: force WLoadingIndicator - Added by Jan Hrubeš 10 months ago
Hi,
I agree with Ulf, that some way of server control of loading indicator is needed.
I suggest to add a flag into loading indicator which can say it should be displayed even no request is active.
My scenario looks like this:
- clicking a button starts an asynchronous operation, I use show() for loading indicator.
- now Wt sometime hides loading indicator (thats unwanted behavior for me)
- after finishing my asnyc. operation I want to show results and hide loading indicator ( using triggerUpdate() ).
regards,
Jan
RE: force WLoadingIndicator - Added by Wim Dumon 10 months ago
Hello Jan,
You can do this with wApp->deferRendering();, right? It's actually for what it was intended. Call it, do your async rendering, and call wApp->resumeRendering() after async processing is done (e.g. from your async thread). You don't need to call triggerUpdate() in this case, as you're still responding to the original request.
BR,
Wim.
(1-7/7)