Monday, October 29, 2012

Re: Destroy a widget

I presume by uibinder owner you mean your HelloWorld class overrides the onEvent() method, is that correct?

I also presume that you have some other component that is using the HelloWorld objects and attaching them to the view.
For example, in your EntryPoint:

HelloWorld h1 = new HelloWorld();
HelloWorld h2 = new HelloWorld();

FlowPanel panel = new FlowPanel();
panel.add(h1);
panel.add(h2);

GWT.getRoot().add(panel);

If you want to "destroy" h1, and have it stop reacting to events, simply remove it from the dom and ensure it is garbage collected (ie. set your reference to null):

panel.remove(h1);
h1 = null;

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/o6TIayyZhVIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment