Make Editors respect onKeyEvent

This commit is contained in:
Grim Maple 2022-12-02 18:45:15 +03:00
parent 7895e417d9
commit 25bc5ef4b9
1 changed files with 39 additions and 35 deletions

View File

@ -2103,6 +2103,8 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
/// handle keys /// handle keys
override bool onKeyEvent(KeyEvent event) { override bool onKeyEvent(KeyEvent event) {
//Log.d("onKeyEvent ", event.action, " ", event.keyCode, " flags ", event.flags); //Log.d("onKeyEvent ", event.action, " ", event.keyCode, " flags ", event.flags);
if(super.onKeyEvent(event))
return true;
if (focused) startCaretBlinking(); if (focused) startCaretBlinking();
cancelHoverTimer(); cancelHoverTimer();
bool ctrlOrAltPressed = !!(event.flags & KeyFlag.Control); //(event.flags & (KeyFlag.Control /* | KeyFlag.Alt */)); bool ctrlOrAltPressed = !!(event.flags & KeyFlag.Control); //(event.flags & (KeyFlag.Control /* | KeyFlag.Alt */));
@ -2133,7 +2135,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
//if (event.keyCode == KeyCode.RETURN && !readOnly && !_content.multiline) { //if (event.keyCode == KeyCode.RETURN && !readOnly && !_content.multiline) {
// return true; // return true;
//} //}
return super.onKeyEvent(event); return true;
} }
/// Handle Ctrl + Left mouse click on text /// Handle Ctrl + Left mouse click on text
@ -2449,6 +2451,8 @@ class EditLine : EditWidgetBase {
/// handle keys /// handle keys
override bool onKeyEvent(KeyEvent event) { override bool onKeyEvent(KeyEvent event) {
if(super.onKeyEvent(event))
return true;
if (enterKey.assigned) { if (enterKey.assigned) {
if (event.keyCode == KeyCode.RETURN && event.modifiers == 0) { if (event.keyCode == KeyCode.RETURN && event.modifiers == 0) {
if (event.action == KeyAction.KeyDown) if (event.action == KeyAction.KeyDown)
@ -2459,7 +2463,7 @@ class EditLine : EditWidgetBase {
} }
} }
} }
return super.onKeyEvent(event); return true;
} }
/// process mouse event; return true if event is processed by widget. /// process mouse event; return true if event is processed by widget.