Results 1 to 3 of 3

Thread: Put min height and width for the whole app

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default Put min height and width for the whole app

    Hi again forum!

    I'm here for an issue that is driving me mad.
    I want my gxt app to be at least 1280x768 because is pretty crowded and this is the minimum size to do not have layout problems.

    I've tried this code (should be cross-browser)
    Code:
    .bodyMinDims{
        min-height: 768px !important;
        height: auto !important;
        height: 768px;
    
    
        min-width: 1280px !important;
        width: auto !important;
        width: 1280px;
    }
    on RootPanel, ViewPort, first widget in the app (a full screen BorderLayout) but when I resize the browser window to be less than 1280x768 my app follows instead of showing scrollbars.
    Tried also a FlowLayoutContainer but without success.
    Any tip for me?

    Many thanks!

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Are you using the GXT Viewport?


    In that case i would extend Viewport and add min check to the sizing (setPixelSize method). You will also need to enable scrolling on browser window itself ( viewport.setEnableScrolling(true); )

    This cannot be done with CSS in most cases.


    I have not tested this.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default

    Yep, it worked like a charm!

    Just for reference here is my extended Viewport

    Code:
            private static final int minWidth = 1280;
            private static final int minHeight = 768;
    
            public ExtViewport() {
    
    this(GWT.<ViewportAppearance> create(ViewportAppearance.class));
    } @Override public void setPixelSize(int width, int height) { if (width < minWidth) width = minWidth; if (height < minHeight) height = minHeight; super.setPixelSize(width, height); if (height < Window.getClientHeight() || width < Window.getClientWidth()) { setPixelSize(Window.getClientWidth(), Window.getClientHeight()); } } public AlboViewport(ViewportAppearance appearance) { super(appearance); this.setEnableScroll(true); }
    Note that I needed to recall setPixelSize because if I'm making the bowser's window smaller the scrollbars appear but they do not count in Window.getClientHeight/Width methods, so they create white gaps after resizing.

    Thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •