Yes, setEnabled() is the thing which can do the job for a standard gwt button. But consider the situation when you want to implement your own button (with rounded corners let's say) named RButton. You implement it as a new widget which extends Composite class and implements ClickHandler interface to get mouse clicks, but here the method setEnabled() is not available. So how to implement the setEnabled() method in this case? Do you suggest to store the ClickHandler in the RButton class itself and remove it in its setEnabled() method, or is there any better way?
On 24 Dub, 06:59, Vitali Lovich <[email protected]> wrote: > In general I think you should keep it with the class that does needs to > remove the handler. I hope you know about setEnabled/setDisabled - that's > the proper way to disable a buttons functionality, not to remove the > handler. In general, I have only encountered 1 situation where I would be > interested in removing a handler - more often than not, you will be > adding/removing the widget itself which should take care off removing the > handlers to free up memory. > > > > On Thu, Apr 23, 2009 at 10:50 AM, romant <[email protected]> wrote: > > > Hi guys, > > with GWT 1.6 there is the new handler-based approach for managing > > events. > > When I register, let's say, a button handler > > > HandlerRegistration buttonRegistration = button.addClickHandler(new > > ClickHandler() {...do something...}); > > > I get an instance of HandlerRegistration. Then, if I want to remove > > the button's handler, let's say for a while just to make the button > > functionality temporarily unavailable, I just call > > > buttonRegistration.removeHandler(); > > > But now the point is where to store the buttonHandler instance. With > > listeners it was easy, you just called button.removeClickListener() > > because the button kept the listener. > > > If I have a large project with many buttons what is the best approach > > for storing and handling the HandlerRegistration instances of my > > buttons and other widgets? Is there any recommended design pattern? > > This can make a real mess in my application if I do not find some > > general solution of this. > > > Thanks. > > Roman- Skrýt citovaný text - > > - Zobrazit citovaný text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
