Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with window size

    Hi,
    I'm facing a problem while setting popup window size. I have a requirement like this: the window should be auto re-sized while loading upto some extent. If the window content crosses the window maximum height, the window should not be extended and the scroll bars should appear for the popup window.

    Im using property:
    window.setAutosize(true);
    window.setMaxHeight(700);

    This is fine if the content is within screen height. But sometimes i may get content large. In this case, the window is extending to accomodate my content. This is really annoying and causing window height more than screen height.
    If i add setHeight(200) method, it is showing window by default height 200px even if the content is not that much.

    Hope i explained my problem clearly. What are the other properties i need to set to achieve my requirement?

    #2
    Code:
    setHeight(10);
    setOverflow(Overflow.VISIBLE);
    setMaxHeight(700);
    try this.

    cheers

    Comment


      #3
      No dude. Its not working :(

      Comment


        #4
        setAutoSize(false);
        setHeight(700);
        setWidth(500);

        Comment


          #5
          No dude. This is fixing the height even there are no that much contents in the window and leaving empty space unnecessarily. I want autosize upto Page/Screen height and after that the window should not autosize and need scroll bars for the window. Is there any way to control the height of the window dynamically?

          Comment


            #6
            1. You can get the window height using Window.getClientHeight() - GWT Method
            2. You can change the size of your Layout or Canvas, after the drawn using ResizeTo() method
            3. You can be notified of window resizing using addResizedHandler()

            If you don't want auto-size, set a Fixed size like said above.

            and please be aware of Overflow properties.

            Regards.

            Comment


              #7
              Im unable to get the actual window height once window gets rendered. Its always showing me 100px, which is default. Im using the following code in addDrawHandler method, to adjust the window height dynamically.
              Code:
              if(window.getHeight()>com.google.gwt.user.client.Window.getClientHeight()){
              						System.out.println("in if...");
                                                              window.setAutoSize(false);
              						window.resizeTo(window.getWidth(), com.google.gwt.user.client.Window.getClientHeight());
              					}else{
              						System.out.println("in else...");
              						window.setAutoSize(true);
              					}
              I've tried the same in doOnRender too. But no use. It is always returning 100px even it exceeds the browser height. I donno how to get the actual height of the window once get rendered? Please suggest me.

              Comment


                #8
                Oh god..problem solved... i need to use window.getOffsetHeight instead of window.getHeight() to get the actual height of the window after it gets rendered.

                Comment

                Working...
                X