tags:

views:

322

answers:

2

GWT introduced with version 1.6 handlers to be used instead of listeners. Now I was used to add and remove those listeners to achieve certain behavior.

But as I move towards using handlers I miss the remove methods. Like removeClickHandler for the click event.

Is there a way to do this, or am I missing something?

+4  A: 

Each add...Handler method returns the HandlerRegistration interface. This interface contains the removeHandler() method. If you want to remove handlers, simple store the returned interface in a variable and call removeHandler when you want to remove the handler.

Hilbrand
He he .... I have also found the solution ... but 33 seconds later ;)
Drejc
A: 

I have found the solution

HandlerRegistration registration = addClickHandler(handler);

...

registration.removeHandler();
Drejc