I'm using SmartGWT on my application and have encountered some issues when trying to get events from the browser. I need to get the ONPASTE event, but when I try to use it, the method onBrowserEvent never even gets called.
Here is the code that I'm using.
import com.google.gwt.user.client.Event;
import com.smartgwt.client.widgets.RichTextEditor;
public class CustomRichTextEditor extends RichTextEditor {
public CustomRichTextEditor() {
super();
sinkEvents(Event.ONPASTE);
}
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
System.out.println("Event.getTypeInt: " + event.getTypeInt() + " - Event.getType: " + event.getType());
switch (event.getTypeInt()) {
case Event.ONPASTE:
System.out.println("Paste Detected");
break;
}
}
}
Can anybody help me?
RichTextEditor actualy do not attach to any input elements. And use textarea element like a container for transport only. It doenst subscribe to events like ONPASTE at all.
This question was first asked in gwt google group. And nice guy Brandon Donnelson found why this do not work and how to solve it.
Here is working gwt example with custom RichTextEditor (about ~300 lines of code in 5 classes and do not think that paste it here is good idea) which add event bindind to RichTextEditor and allow to ONPASTE and some other events work. It works as follow:
p.s. Also keep in mind, this RichTextEditor strange behaviour was submited as bug in november 2011. But still not fixed in original code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With