-
Sencha User
Answered: How to manually call resize on a changed Viewport
Hi all,
I spent about 3-4 hours fighting with this, and maybe someone can point me what Im missing!
I use extgwt(its un older project) and I have extended the Viewport which dose window resize tracking
in a class like this
public class MainFrame extends Viewport {
final BorderLayout layout = new BorderLayout();
code where border layout components are added
public void fireMainViewResize(){
windowResizeTask.delay(windowResizeDelay);
// onWindowResize(Window.getClientWidth(), Window.getClientHeight());
}
In one of the components, which is added in the viewport as a BorderLayout.Left, on runtime(after initial show) I add some child components and this makes perent component to incrise in its y size. This is all expected. After this I want to re-draw the component so it can addopt to this new size and fit the viewport size again.
I tried calling layout, layout(force=true) but dose nothing.
Then I tried calling window resize on the Viewport with a layout(force), also nothing.
If I manualy resize the browser all get adopted to the viewport size, so I cannot find out what else is actually called when the browser is relly resized.
I did a try to call all the related Window.resizeHandlers by jsni methods because they are not visible,
once like this:
private native void fireManulaWindowResize() /*-{
try {
$wnd.console.log("fireManulaWindowResize start");
$wnd.onresize(new Object());
$wnd.console.log("fireManulaWindowResize end");
} catch (err){
$wnd.console.log("Error on manual call for resize: " + err);
}
}-*/;
and like this
private native void fireManulaWindowResize() /*-{
try {
$wnd.console.log("fireManulaWindowResize start");
@com.google.gwt.user.client.Window::onResize()();
$wnd.console.log("fireManulaWindowResize end");
// $wnd.alert("$wnd.resized");
} catch (err){
$wnd.console.log("Error on manual call for resize: " + err);
}
}-*/;
No exception in the calles, but the added handleres are never executed...
Someone idea on how to force the viewport to re-renderer(re-calculate) its children sizes and paint again?
Tnx for any idea,
Blaze
-
Best Answer Posted by
baze
Ok after a lot of fight, I found a solution.
The size for the component was somehow counted as not changed.
With a call to getOffsetHeigt() to remember the height before adding new components, and setting the same size after with a calling to layout(force) did the job. Seems like the size was not tracked correct in the listeners...
-
Sencha User
Ok after a lot of fight, I found a solution.
The size for the component was somehow counted as not changed.
With a call to getOffsetHeigt() to remember the height before adding new components, and setting the same size after with a calling to layout(force) did the job. Seems like the size was not tracked correct in the listeners...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules