Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT pasting event

Tags:

copy-paste

gwt

I want to handle events when user pastes some text in TextBox. Which event is fired in this situation? I tried ValueChange and Change handlers, but they didn't work.

like image 560
ryskajakub Avatar asked Oct 25 '10 19:10

ryskajakub


1 Answers

This might help you. Describes a workaround to hook to the onpaste event. In short:

  • subclass TextBox

  • sink the onpaste event in the constructor

    sinkEvents(Event.ONPASTE);
  • override onBrowserEvent(Event event)

    public void onBrowserEvent(Event event) {
        super.onBrowserEvent(event);
        switch (event.getTypeInt()) {
            case Event.ONPASTE: {
                // do something here
                break;
            }
        }
    }
like image 167
z00bs Avatar answered Sep 21 '22 16:09

z00bs