I use the following code

public class ShowHourGlass extends FlowPanel {
>
>     Button showHourGlass = new Button("Show HourGlass");
>
>     protected void onLoad(){
>         this.add(showHourGlass);
>         showHourGlass.addClickHandler(new ClickHandler(){
>
>             @Override
>             public void onClick(ClickEvent event) {
>                 //showWaitCursor();
>                 RootPanel.get().setStyleName("waitCursor");
>                 Timer t = new Timer() {
>                       public void run() {
>                         // do something after a delay
>                           //showDefaultCursor();
>                         RootPanel.get().setStyleName("defaultCursor");
>                       }
>                     };
>                 // delay running for 1 seconds
>                 t.schedule(1000);
>             }
>
>         });
>     }
> }
>

and the css is as follow:

>
> .waitCursor{
>     cursor:wait;
> }
>
> .defaultCursor{
>     cursor:default;
> }


and found some problem,
1) after click the button and move the mouse cursor away from the button
and then stay (not move), the cursor will change to wait but will not
change back to default, I need to move the cursor to make it return to
default state.
2) even I keep moving the mouse cursor, I found the time to return to
default cursor is longer than 1 sec even I set

> t.schedule(1000);

 3) If the mouse cursor not leave the button, the cursor is still in hand
shape and the user can continue click the button many times.

how to solve the above problem?


On Tue, Apr 3, 2012 at 6:23 PM, Jens <jens.nehlme...@gmail.com> wrote:

> You have to set the CSS rule "cursor:wait" or "cursor:progress" on the
> element where the mouse cursor should be changed. If it should change for
> the whole site, you would add it to the body tag (accessible through
> RootPanel.get()) or to a glasspane like div that you maybe already have for
> disabling all mouse events.
>
> -- J.
>
> Am Dienstag, 3. April 2012 12:07:10 UTC+2 schrieb tong123123:
>
>> For lengthy process, I want to set the mouse pointer to hourglass, how to
>> do it in GWT?
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/gdov4VIG5Q4J.
>
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

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

Reply via email to