Events GWT取消RichTextBox中的按键事件
我想取消RichTextBox中的特定按键事件 它描述了如何在常规文本框中执行此操作,但在RichTextArea中不起作用,因为它没有cancelKey()方法 这是我的密码:Events GWT取消RichTextBox中的按键事件,events,gwt,richtextbox,keypress,Events,Gwt,Richtextbox,Keypress,我想取消RichTextBox中的特定按键事件 它描述了如何在常规文本框中执行此操作,但在RichTextArea中不起作用,因为它没有cancelKey()方法 这是我的密码: RichTextArea richTextArea = new RichTextArea(); ... richTextArea.addKeyPressHandler(new KeyPressHandler() { @Override public void onKe
RichTextArea richTextArea = new RichTextArea();
...
richTextArea.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent arg0) {
if (arg0.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
// Here is where I would like to prevent the ENTER key from going to the richTextBox
}
}
});
试试这个对我来说很好用
RichTextArea richTextArea = new RichTextArea();
richTextArea.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent arg0) {
if (arg0.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
arg0.getNativeEvent().preventDefault();
}
}
});
你想禁用的关键事件是什么?他在qtn中已经提到他想取消按键event@sᴜʀᴇsʜᴀᴛᴛᴀ 如何禁用键盘中的所有键?:)@Naveen只需删除
if
条件:)。这将阻止所有按键。@sᴜʀᴇsʜᴀᴛᴛᴀ 明白了:)