I'm creating a web application using GWT. My base panel is a RootLayoutPanel and I added on it a DockLayoutPanel on which I attached my components (chat, tables, etc..).
My problem comes on changing the browse开发者_如何学Cr window size. I want my page to be resized only until a certain minimum dimension, then I want the scrollbars to become active.
I tried to use overflow and min-width css properties but it seems not working: if I set my DockLayoutPanel min-width:800px (for example) the panel will be fully visible only until my browser window has 800px of width, and that's correct, but if I reduce again the window size the scrollbars don't get active and the more external parts of the panel can't be viewed in any way.
I hope I'd been clear enough with my explanation. Thank you for your advices.
not sure it it still helps, but I faced similar problem and found such a solution - as mentioned in GWT documentation at http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#Resize I've added to my root html page a tag like:
<body>
..
<div id="main" ></div>
..
</body>
then in onModuleLoad method instead of adding the panel like:
interface Binder extends UiBinder<Widget, BasicApp> { }
private static final Binder binder = GWT.create(Binder.class);
public void onModuleLoad() {
DockLayoutPanel outer = binder.createAndBindUi();
RootLayoutPanel.get().add(outer);
}
I do it that way:
public void onModuleLoad() {
DockLayoutPanel outer = binder.createAndBindUi();
LayoutPanel panel = new LayoutPanel();
panel.add(outer);
RootPanel.get("main").add(panel);
panel.setSize("800px", "800px");
}
NOTE that you must set explicitly the size of the panel to properly display on web page. You should have now scrolls as on any other web page when the panel size exceeds window size.
Try
RootLayoutPanel().get().add(new ScrollPanel(dockLayoutPanel));
精彩评论