Reputation: 374
I have a Dialogbox class:
public class Dialogbox {
public static final Window dialogbox = new Window();
public Dialogbox() {
dialogbox.setAnimateMinimize(true);
dialogbox.setWidth(469);
dialogbox.setHeight(487);
dialogbox.setShowMinimizeButton(true);
dialogbox.setAutoSize(true);
dialogbox.setCanDragReposition(true);
dialogbox.setCanDragResize(true);
dialogbox.setIsModal(true);
// dialogbox.setShowModalMask(true);
dialogbox.addCloseClickHandler(new CloseClickHandler() {
@Override
public void onCloseClick(CloseClientEvent event) {
// TODO Auto-generated method stub
dialogbox.destroy();
}
});
}
public void show(Widget name, String txt) {
dialogbox.setTitle(txt);
dialogbox.addItem(name);
dialogbox.setPadding(10);
AnimationCallback callback = null;
dialogbox.animateMove(400, 100, callback, 1000);
dialogbox.show();
}
When I try a Composite:
f list = new f();
dia.show(f, "price");
I get the error:
[ERROR] 15:34:20.020:WARN:Canvas:isc_WidgetCanvas_1:Attempt to access destroyed widget in the DOM - destroy() called at invalid time (eg: mid-draw) or invalid method called on destroy()d widget. Stack Trace:
My in-Box Composite is a Widget:
Canvas canvas = new Canvas();
canvas.addChild(btnNewButton);
initWidget(canvas);
Why can't I destroy my Dialogbox? Do I have to remove the widget first?
Upvotes: 0
Views: 514
Reputation: 328
Yes, if you want just hide the Dialog box,
then you can use
dialogbox.hide()
Where as, if you want to delete the Dialog box,
then you can Detach/Delete it from it's Parent element by using
dialogbox.removeFromParent()
But, as my expectation you just want to hide the Dialog Box.
Here, I gave two ways, you can use it based on your requirement.
Upvotes: 1