diff --git a/radio/src/thirdparty/libopenui/src/checkbox.cpp b/radio/src/thirdparty/libopenui/src/checkbox.cpp index f29a38e4c..d62c6a939 100644 --- a/radio/src/thirdparty/libopenui/src/checkbox.cpp +++ b/radio/src/thirdparty/libopenui/src/checkbox.cpp @@ -85,3 +85,15 @@ void CheckBox::onEvent(event_t event) } #endif +#if defined(HARDWARE_TOUCH) +bool CheckBox::onTouchEnd(coord_t x, coord_t y) +{ + if (!hasFocus()) { + setFocus(SET_FOCUS_DEFAULT); + } + + return true; +} +#endif + + diff --git a/radio/src/thirdparty/libopenui/src/checkbox.h b/radio/src/thirdparty/libopenui/src/checkbox.h index e85ceb13c..32f8fc94a 100644 --- a/radio/src/thirdparty/libopenui/src/checkbox.h +++ b/radio/src/thirdparty/libopenui/src/checkbox.h @@ -47,6 +47,10 @@ class CheckBox : public FormField { void onEvent(event_t event) override; #endif +#if defined(HARDWARE_TOUCH) + bool onTouchEnd(coord_t x, coord_t y) override; +#endif + uint8_t getValue() const { return _getValue(); diff --git a/radio/src/thirdparty/libopenui/src/textedit.cpp b/radio/src/thirdparty/libopenui/src/textedit.cpp index 38a795193..871f2cbf8 100644 --- a/radio/src/thirdparty/libopenui/src/textedit.cpp +++ b/radio/src/thirdparty/libopenui/src/textedit.cpp @@ -261,18 +261,19 @@ bool TextEdit::onTouchEnd(coord_t x, coord_t y) TextKeyboard::show(this); #endif - coord_t rest = x; - for (cursorPos = 0; cursorPos < length; cursorPos++) { - char c = value[cursorPos]; - if (c == '\0') - break; - uint8_t w = getCharWidth(c, fontspecsTable[0]) + 1; - if (rest < w) - break; - rest -= w; - } + // coord_t rest = x; + // for (cursorPos = 0; cursorPos < length; cursorPos++) { + // char c = value[cursorPos]; + // if (c == '\0') + // break; + // uint8_t w = getCharWidth(c, fontspecsTable[0]) + 1; + // if (rest < w) + // break; + // rest -= w; + // } + + // invalidate(); - invalidate(); return true; } #endif diff --git a/radio/src/thirdparty/libopenui/src/textedit.h b/radio/src/thirdparty/libopenui/src/textedit.h index 6770141f8..a9965b0e9 100644 --- a/radio/src/thirdparty/libopenui/src/textedit.h +++ b/radio/src/thirdparty/libopenui/src/textedit.h @@ -67,7 +67,9 @@ class TextEdit : public FormField { void changeEnd(bool forceChanged = false) override { - strncpy(value, lv_textarea_get_text(lvobj), length); + if (lvobj != nullptr) + strncpy(value, lv_textarea_get_text(lvobj), length); + cursorPos = 0; if (changed || forceChanged) { changed = false;