GWT pasting event

前端 未结 3 1003
北海茫月
北海茫月 2021-01-05 05:22

I want to handle events when user pastes some text in TextBox. Which event is fired in this situation? I tried ValueChange and Change

3条回答
  •  无人及你
    2021-01-05 05:56

    GWT does not yet have support for cut, copy & paste: http://code.google.com/p/google-web-toolkit/issues/detail?id=4030

    Edited: Another option is to use JSNI. For example add this to your GWT class:

    public native void addCutHandler(Element element)
        /*-{
            var temp = this;  // hack to hold on to 'this' reference
            element.oncut = function(e) {
                temp.@org.package.YourClass::handleCut()();
            }
        }-*/;
    
    public void handleCut() {
        Window.alert("Cut!");
    }
    

提交回复
热议问题