PDA

View Full Version : SinkEvents



blay
27 Dec 2010, 3:53 AM
Hello:

I´ve added a listener like this:


Document.get().addListener(Events.OnKeyPress, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
if (ce.getKeyCode()== KeyCodes.KEY_ENTER)
doWhatheverShouldBeDone();
}

});

So when I press Enter , something happens. That´s right. But I´ve read about sinkEvents and I don´t understand it well. As far as I know, in GXT, it has to be used for components to listen to events that are not supported by default. I don´t know if in this case it´s needed or not...or if I´m wrong in some assumptions I´m doing...

Can anyone explain me briefly when I should use sinkEvent and its porpuse?

Thanks

sven
27 Dec 2010, 4:59 AM
You need to sink browser events before you can listen to them. GXT 2.2 automatically sinks them if you want to listen to a browser event.



As far as I know, in GXT, it has to be used for components to listen to events that are not supported by default
This is not linked to GXT, but GWT.