Search code examples
gwtlayoutscrollbargxt

GXT ScrollBar overlapping content


I'm using setScrollMode(ScrollMode.AUTOY) to enable vertical scrolling when necessary on a VerticalLayoutContainer. However, the scrollbar overlaps the content of the container. The only way around this that I've seen is to call setAdjustForScroll(true). The problem with this is that The panel will then always reserve space for a scrollbar even when one is not present.

Is there a way to tell GXT to only adjust for a scrollbar when one is present? Or perhaps use an event handler (eg ResizeHandler) and check if the scrollbar is currently visible?


Solution

  • Instead of trying to check in a handler if the scrollbar is visible, isn't it just easier to not have the content in the VerticalLayoutContainer?

    For example I have:

    VerticalLayoutContainer vp = new VerticalLayoutContainer();
    
    vp.setScrollMode(ScrollMode.AUTO);
    
    vp.add(layer1, new VerticalLayoutData(1, -1));
    vp.add(layer2, new VerticalLayoutData(1, -1));
    vp.add(layer3, new VerticalLayoutData(1, -1));
    

    the layers(1-3) contain the actual content and are different types Ex. VBoxLayoutContainer, Container, VerticalLayoutContainer.

    It works for me. I don't think it is relevant but I am adding the vp to a CenterLayoutContainer that is added to the root panel.