Announcement
Collapse
No announcement yet.
X
-
I've added a drawHandler to the window like this.
The problem is, the if condition isn't met so the height isn't adjusted. getHeight reports that the window height is 100 and isDrawn is true, but the actual window height is much more than 100.Code:window.addDrawHandler(new DrawHandler() { @Override public void onDraw(DrawEvent event) { int viewportHeight = com.google.gwt.user.client.Window.getClientHeight(); Window theWindow = (Window)event.getSource(); if (theWindow.getHeight()>viewportHeight) theWindow.setHeight(viewportHeight); } });
Is a drawHandler the wrong way to go about this? If so, how can I find out how tall the window is and then resize it?
Leave a comment:
-
keepInParentRect affects dragging, but won't limit auto-sizing.
The simplest approach here would probably be to check the Windows's size after adding or removing fields, and calling setHeight() if it would exceed the viewport, otherwise setAutoSize() to shrink back to minimum size.
Leave a comment:
-
Window setAutoSize(true) and setKeepInParentRect(true)
I have a Window where I setAutoSize(true) and setKeepInParentRect(true). I then create a VLayout containing a DynamicForm and an HLayout with a couple of IButtons which I then addItem(the VLayout) to the window.
The DynamicForm has a variable number of fields in it. When the number of fields is large, the DynamicForm is too tall to fit in the viewport, and even with setKeepInParentRect(true) this causes the Window to exceed the size of the parent rectangle.
How can I prevent this? I tried setting maxHeight on the Window, the layout and the form and none seem to have the desired effect of keeping the Window inside the viewport and creating a scrollbar to scroll and see the full layout.Tags: None
Leave a comment: