Form navigation fix
This commit is contained in:
+27
-9
@@ -129,20 +129,32 @@ void FormGroup::setFocus(uint8_t flag)
|
|||||||
if (windowFlags & FORM_FORWARD_FOCUS) {
|
if (windowFlags & FORM_FORWARD_FOCUS) {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case SET_FOCUS_FIRST:
|
case SET_FOCUS_FIRST:
|
||||||
if (first)
|
if (first) {
|
||||||
first->setFocus(SET_FOCUS_FIRST);
|
first->setFocus(SET_FOCUS_FIRST);
|
||||||
|
}
|
||||||
|
else if (next) {
|
||||||
|
next->setFocus(SET_FOCUS_FIRST);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SET_FOCUS_BACKWARD:
|
case SET_FOCUS_BACKWARD:
|
||||||
if (focusWindow->isChild(first)) {
|
if (focusWindow->isChild(first)) {
|
||||||
if (previous == this)
|
if (previous == this) {
|
||||||
last->setFocus(SET_FOCUS_BACKWARD);
|
last->setFocus(SET_FOCUS_BACKWARD);
|
||||||
else if (previous)
|
}
|
||||||
|
else if (previous) {
|
||||||
previous->setFocus(SET_FOCUS_BACKWARD);
|
previous->setFocus(SET_FOCUS_BACKWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (last)
|
if (last) {
|
||||||
last->setFocus(SET_FOCUS_BACKWARD);
|
last->setFocus(SET_FOCUS_BACKWARD);
|
||||||
|
}
|
||||||
|
else if (previous) {
|
||||||
|
clearFocus();
|
||||||
|
focusWindow = this;
|
||||||
|
previous->setFocus(SET_FOCUS_BACKWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -151,24 +163,30 @@ void FormGroup::setFocus(uint8_t flag)
|
|||||||
if (next == this) {
|
if (next == this) {
|
||||||
first->setFocus(SET_FOCUS_FORWARD);
|
first->setFocus(SET_FOCUS_FORWARD);
|
||||||
}
|
}
|
||||||
else if (next)
|
else if (next) {
|
||||||
next->setFocus(SET_FOCUS_FORWARD);
|
next->setFocus(SET_FOCUS_FORWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (first) {
|
if (first) {
|
||||||
first->setFocus(SET_FOCUS_FORWARD);
|
first->setFocus(SET_FOCUS_FORWARD);
|
||||||
}
|
}
|
||||||
|
else if (next) {
|
||||||
|
clearFocus();
|
||||||
|
focusWindow = this;
|
||||||
|
next->setFocus(SET_FOCUS_FORWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (focusWindow == previous) {
|
if (focusWindow == previous) {
|
||||||
if (first)
|
if (first) {
|
||||||
first->setFocus(SET_FOCUS_DEFAULT);
|
first->setFocus(SET_FOCUS_DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (next) {
|
||||||
if (next)
|
next->setFocus(SET_FOCUS_FORWARD);
|
||||||
next->setFocus(SET_FOCUS_FORWARD);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -124,6 +124,9 @@ class FormGroup: public FormField {
|
|||||||
Window::clear();
|
Window::clear();
|
||||||
first = nullptr;
|
first = nullptr;
|
||||||
last = nullptr;
|
last = nullptr;
|
||||||
|
if (previous && (windowFlags & FORM_FORWARD_FOCUS)) {
|
||||||
|
previous->setNextField(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFocus(uint8_t flag) override;
|
void setFocus(uint8_t flag) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user