From 76a3886a037ece6785811c4d7c962f9a6537e645 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Wed, 9 Jun 2021 07:22:33 +0200 Subject: [PATCH] Use EVT_KEY_FIRST(KEY_EXIT) instead of EVT_KEY_BREAK() in FormGroup This prevents the TabGroup from catching the event first, and thus quit the complete page. Resolves EdgeTX/edgetx#164 --- radio/src/thirdparty/libopenui/src/form.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/form.cpp b/radio/src/thirdparty/libopenui/src/form.cpp index 04a13a8bb..2c75aa53b 100644 --- a/radio/src/thirdparty/libopenui/src/form.cpp +++ b/radio/src/thirdparty/libopenui/src/form.cpp @@ -225,20 +225,18 @@ void FormGroup::onEvent(event_t event) if (event == EVT_KEY_BREAK(KEY_ENTER)) { onKeyPress(); setFocusOnFirstVisibleField(SET_FOCUS_FIRST); - } - else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus() && !(windowFlags & FORM_FORWARD_FOCUS)) { + } else if (event == EVT_KEY_FIRST(KEY_EXIT) && !hasFocus() && + !(windowFlags & FORM_FORWARD_FOCUS)) { + killEvents(event); onKeyPress(); - setFocus(SET_FOCUS_DEFAULT); // opentx - model - timers settings - } - else if (event == EVT_ROTARY_RIGHT && !next) { + setFocus(SET_FOCUS_DEFAULT); // opentx - model - timers settings + } else if (event == EVT_ROTARY_RIGHT && !next) { onKeyPress(); setFocusOnFirstVisibleField(SET_FOCUS_FIRST); - } - else if (event == EVT_ROTARY_LEFT && !previous) { + } else if (event == EVT_ROTARY_LEFT && !previous) { onKeyPress(); setFocusOnLastVisibleField(SET_FOCUS_BACKWARD); - } - else { + } else { FormField::onEvent(event); } }