Right, when i call reference.removeHandler() I disable the click event, but when I want to enable it again there is no simple way. The point is that some "outer" components will be registered as ClickHandlers in my Button class extending Composite. Actually the Button itself does not care about click event, there is no reason to react on it, some outer components registered in the Button as click handlers do. And i want to know how to stop them receive the click event and when necessary to make them receive the event again. There must be some design pattern or best practice how to do that, it is so goddamn common feature. But with the new event handling mechanism I am a bit lost.
On 22 čvn, 18:52, mabogie <[email protected]> wrote: > The handler registration is, as far as I know, just a way to register > a new handler to a composite. > > The exact detection happens when the clickhandler is added to the > composite: > HandlerRegistration reference = > yourCompositewidget.addClickHandler > (new ClickHandler(){ > > public void onClick(ClickEvent event) { > yourCompositewidget.dosomething(); > } > > }); > > The disabling (removing of the handler) would happen with > reference.removeHandler(); > > That's the simplest way to do this I think. > > On 22 jun, 16:34, romant <[email protected]> wrote: > > > Hi guys, > > I have my own Button class which extends Composite. I use grid which > > creates the basement of the button component. You can of course detect > > click events on the grid/button by calling > > > public HandlerRegistration addClickHandler(ClickHandler handler) { > > return addDomHandler(handler, ClickEvent.getType()); > > } > > > That's probably not the best approach considering the fact that now i > > need the possibility to implement "disable" function which should > > disable the click events. What is generally the best approach to > > achieve that? Should I store all the registered click handlers in a > > list and unregister them, then after enabling the button register them > > again? > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
