Surprised at your reaction to this.  I find myself doing the same more and 
more as I'm using less and less widgets.  Is there a better way when 
dealing with non-widget elements? 

On Tuesday, October 4, 2016 at 11:57:24 AM UTC+2, Thomas Broyer wrote:
>
>
>
> On Tuesday, October 4, 2016 at 1:04:06 AM UTC+2, David wrote:
>>
>> I use the following code to create an EventListener:
>>
>>                       Event.sinkEvents(divElement, Event.ONCLICK);
>>                      final EventListener listener = new EventListener() 
>> {...};
>>                      Event.setEventListener(divElement, listener);
>>
>
> Please tell me this is legacy code from GWT 1.x times…
> (why not use a widget? or event delegation?)
>  
>
>> How do I remove EventListener late if I don't want to delete the created 
>> divElement?
>>
>
> If you want to stop listening to all events (and easily reattach the 
> listener later on, triggered on the same events):
> Event.setEventListener(divElement, null);
> to stop listening to click events:
> Event.sinkEvents(divElement, 0); // unsinks all events, but you only had 
> ONCLICK
> or
> Event.sinkEvents(divElement, Event.getEventsSunk() & ~Event.ONCLICK);
>  
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to