1. fixed checkbox focus on touch
2. fixed crash if you edit a textbox and close the simu. TextEdit changeEnd() wasnt checking lvgl for validity 3. removed dead code in new TextEdit onTouchEnd()
This commit is contained in:
committed by
Raphael Coeffic
parent
0429341528
commit
6a8707fb69
+12
@@ -85,3 +85,15 @@ void CheckBox::onEvent(event_t event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_TOUCH)
|
||||||
|
bool CheckBox::onTouchEnd(coord_t x, coord_t y)
|
||||||
|
{
|
||||||
|
if (!hasFocus()) {
|
||||||
|
setFocus(SET_FOCUS_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ class CheckBox : public FormField {
|
|||||||
void onEvent(event_t event) override;
|
void onEvent(event_t event) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_TOUCH)
|
||||||
|
bool onTouchEnd(coord_t x, coord_t y) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t getValue() const
|
uint8_t getValue() const
|
||||||
{
|
{
|
||||||
return _getValue();
|
return _getValue();
|
||||||
|
|||||||
+12
-11
@@ -261,18 +261,19 @@ bool TextEdit::onTouchEnd(coord_t x, coord_t y)
|
|||||||
TextKeyboard::show(this);
|
TextKeyboard::show(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
coord_t rest = x;
|
// coord_t rest = x;
|
||||||
for (cursorPos = 0; cursorPos < length; cursorPos++) {
|
// for (cursorPos = 0; cursorPos < length; cursorPos++) {
|
||||||
char c = value[cursorPos];
|
// char c = value[cursorPos];
|
||||||
if (c == '\0')
|
// if (c == '\0')
|
||||||
break;
|
// break;
|
||||||
uint8_t w = getCharWidth(c, fontspecsTable[0]) + 1;
|
// uint8_t w = getCharWidth(c, fontspecsTable[0]) + 1;
|
||||||
if (rest < w)
|
// if (rest < w)
|
||||||
break;
|
// break;
|
||||||
rest -= w;
|
// rest -= w;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// invalidate();
|
||||||
|
|
||||||
invalidate();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-1
@@ -67,7 +67,9 @@ class TextEdit : public FormField {
|
|||||||
|
|
||||||
void changeEnd(bool forceChanged = false) override
|
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;
|
cursorPos = 0;
|
||||||
if (changed || forceChanged) {
|
if (changed || forceChanged) {
|
||||||
changed = false;
|
changed = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user