Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:21:46+00:00 2026-06-09T17:21:46+00:00

In my GWT application, I have a button to which I’ve attached a click

  • 0

In my GWT application, I have a button to which I’ve attached a click handler via JSNI and jQuery. The JSNI looks something like this:

private native void attachClickActions() /*-{
    $wnd.jQuery("#theButton").click(function() {
        // ...
        $wnd.jQuery(this).animate({
            // ...
        }, 500, function() {
            @com.google.gwt.user.client.Window::onResize()();
        });
    });
}-*;

(No, we cannot do this via a ClickHandler in the Java code for various reasons which are not up for discussion.)

In essence, when the user clicks the button, a jQuery animate() is called and when it finishes, the callback function calls Window.onResize(). Pretty simple.

And it works, the first time. When the user clicks the button, the animation occurs, and the onResize is called. But all subsequent clicks do not fire the onResize action, even though the animate() function completes successfully. Any other code I put in the callback, such as alert(), happens every time the animation completes, so it’s not an issue with the callback. I know that the onResize() is not called subsequent times because the animate action applies a bunch of changes to the size of the element, and when the onResize() is triggered you can see the change occur.

Why does the Window.onResize() only get called the first time, with subsequent calls ignored?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:21:47+00:00Added an answer on June 9, 2026 at 5:21 pm

    The reason this was happening is due to how the GWT team wrote the onResize() event in the Window class. Apparently, certain browser engines like Trident (IE) and Webkit (Chrome, Safari), there are some cases where the onResize event is triggered multiple times when it should only happen once. To handle this situation, the implementation of the onResize() method includes a check of the browser window’s current size: if the size hasn’t changed since the last onResize() call, it’s not triggered again.

    Since I was essentially trying to call the onResize() event multiple times on a window that hadn’t actually resized, this IE/Webkit “fix” was stopping the event from firing.

    Here’s the actual code of the onResize() method if anyone’s curious:

    static void onResize() {
        if (resizeHandlersInitialized) {
            // On webkit and IE we sometimes get duplicate window resize events.
            // Here, we manually filter them.
            int width = getClientWidth();
            int height = getClientHeight();
            if (lastResizeWidth != width || lastResizeHeight != height) {
                lastResizeWidth = width;
                lastResizeHeight = height;
                ResizeEvent.fire(getHandlers(), width, height);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GWT application which I would like to run from within a
I have a grid in my GWT application there are columns and rows which
I have an application which is packaged as a .war file. It has GWT
I have a GWT application which is secured by Spring Security. I have a
Currently, I have a GWT based application /app.htm It displays an openId login button
I have a GWT application for which I'm trying to write some tests using
I have a GWT application that includes an embedded applet. I would like to
I have a very simple GWT application which collects some data and provides a
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
I am new to GWT. I have developed a GWT application in version-1.6.4 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.