Form navigation fix

This commit is contained in:
Bertrand Songis
2020-05-15 12:46:57 +02:00
parent c4164e8302
commit c07b28d3cc
2 changed files with 30 additions and 9 deletions
+27 -9
View File
@@ -129,20 +129,32 @@ void FormGroup::setFocus(uint8_t flag)
if (windowFlags & FORM_FORWARD_FOCUS) {
switch (flag) {
case SET_FOCUS_FIRST:
if (first)
if (first) {
first->setFocus(SET_FOCUS_FIRST);
}
else if (next) {
next->setFocus(SET_FOCUS_FIRST);
}
break;
case SET_FOCUS_BACKWARD:
if (focusWindow->isChild(first)) {
if (previous == this)
if (previous == this) {
last->setFocus(SET_FOCUS_BACKWARD);
else if (previous)
}
else if (previous) {
previous->setFocus(SET_FOCUS_BACKWARD);
}
}
else {
if (last)
if (last) {
last->setFocus(SET_FOCUS_BACKWARD);
}
else if (previous) {
clearFocus();
focusWindow = this;
previous->setFocus(SET_FOCUS_BACKWARD);
}
}
break;
@@ -151,24 +163,30 @@ void FormGroup::setFocus(uint8_t flag)
if (next == this) {
first->setFocus(SET_FOCUS_FORWARD);
}
else if (next)
else if (next) {
next->setFocus(SET_FOCUS_FORWARD);
}
}
else {
if (first) {
first->setFocus(SET_FOCUS_FORWARD);
}
else if (next) {
clearFocus();
focusWindow = this;
next->setFocus(SET_FOCUS_FORWARD);
}
}
break;
default:
if (focusWindow == previous) {
if (first)
if (first) {
first->setFocus(SET_FOCUS_DEFAULT);
}
}
else {
if (next)
next->setFocus(SET_FOCUS_FORWARD);
else if (next) {
next->setFocus(SET_FOCUS_FORWARD);
}
break;
}
+3
View File
@@ -124,6 +124,9 @@ class FormGroup: public FormField {
Window::clear();
first = nullptr;
last = nullptr;
if (previous && (windowFlags & FORM_FORWARD_FOCUS)) {
previous->setNextField(this);
}
}
void setFocus(uint8_t flag) override;