Search code examples
gwtgxthtml-editor

GWT, GXT HtmlEditor, Key Event


No matter what I try, when I add addListener(Events.KeyPress, new Listener() { public void handleEvent(FieldEvent e) { changed = true; } });

OR

    addKeyListener(new KeyListener() {
        public void componentKeyDown(ComponentEvent event) {
            changed = true;
        }
    });

Nothing registers... the event is not captured. Anybody know how to make this work?

Thank you. Kirt


Solution

  • Currently you have to extend HtmlEditor and overwrite onEditorKeyDown().

    class ExtendedHtmlEditor extends HtmlEditor {
    
        public ExtendedHtmlEditor() {
            super();
        }
    
        @Override
        protected void onEditorKeyDown(KeyDownEvent e) {
            super.onEditorKeyDown(e);
            Window.alert("w000t");
        }
    
    }
    

    See also here.