Browsers are single threaded.  If it was the case that your onModuleLoad was
actually taking a long time, then the browser wouldn't be doing anything
else.  If that's the case, then try breaking up your onModuleLoad into
several parts & then do:

    enum StartupTask {
          TASK1:
          TASK2:
          TASK3:
    }
DeferredCommand.addCommand(new IncrementalCommand() {
    StartupTask current = StartupTask.TASK1;

    public boolean execute() {
            switch (current) {
                case TASK1:
                      // do my initialization
                      current = TASK2;
                      break;
                case TASK2:
                       // continue intialization
                       current = TASK3:
                case TASK3:
                       // finish initialization
                       current = null;
            }
            return current != null;
    }
});

That's one way to do it.  Or you could add a bunch of Command instances
instead of using incremental command.  Any number of ways to do this.  Are
you sure though that your onModuleLoad takes a long time?

Try instrumenting it first:

public void onModuleLoad()
{
       long start = System.currentTimeMillis();
       // rest of code
       long elapsed = System.currentTimeMillis() - start;
       Window.alert("Initialization took " + elapsed + " milliseconds");
}

On Fri, Apr 10, 2009 at 9:05 PM, Nick <[email protected]> wrote:

>
> I've created a GWT project and included a div tag with an animated gif
> in it. The idea is, while my GWT application loads, you'll see this
> image moving because it is included in the static HTML file. When the
> onModuleLoad() function is almost done, I remove this div from the
> DOM, thus removing the image.
>
> My problem is, the GIF image freezes and doesn't move while my
> application is loading. The image only moves if there is a problem in
> my app and it never loads.
>
> Is there a way to include a moving image, a GIF, while the onModuleLoad
> () function is running? I'm not sure why it is freezing.
>
> I look forward to a creative answer.
>
> Thanks,
> Nick
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to