PDA

View Full Version : Can't show a window on "onSuccess" method



edumrf
20 May 2009, 4:39 AM
Is there any way to show a window or any other component on a "onSuccess" method?
I'm trying the following code and the window never show up!


proxy.getServiceValue("br.com.dyad.infrastructure.service.LookupService", params, new AsyncCallback(){
public void onFailure(Throwable arg0) {
Window.alert(arg0.getMessage());
}
public void onSuccess(HashMap arg0) {
Window wnd = new Window();
desktop.add(wnd);
wnd.show();
}
}

Any ideas?
Thanks.

lkrylov
22 May 2009, 4:38 AM
I'm not sure if this is what you want, but I had a similar issue with showing components created as a result of an RPC call. The key was to call layout() after adding.



public void onSuccess(ComponentData result) {
Component c = createComponent(ComponentData);
add(c);
layout(); // Calling layout() on the parent LayoutContainer of the newly added Component
}


Hope this helps

edumrf
22 May 2009, 4:59 AM
Thanks for the tip, i already tried the layout method and still doens't show, i just figure out that i had some issues with my rpc call and the error never showed up on the console.

FireGlow
25 May 2009, 4:42 AM
Hey!

at first it doesn't make sense to add the window to a desktop.

Second, maybe try to set some attributes before you show the window:


wnd.setLayout( new FitLayout() );
wnd.setModal( true );
wnd.setHeight(800);
wnd.setWidth( 800 );
wnd.setBorders( true );And are you sure that your call is even fired, breakpoint inside your success-method!