Focus fixes
This commit is contained in:
+3
-3
@@ -74,10 +74,10 @@ class ExpansionPanel: public FormGroup {
|
|||||||
|
|
||||||
void setFocus(uint8_t flag) override
|
void setFocus(uint8_t flag) override
|
||||||
{
|
{
|
||||||
if (!isOpen)
|
if (isOpen)
|
||||||
header->setFocus(flag);
|
|
||||||
else
|
|
||||||
FormGroup::setFocus(flag);
|
FormGroup::setFocus(flag);
|
||||||
|
else
|
||||||
|
header->setFocus(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormGroup * body = nullptr;
|
FormGroup * body = nullptr;
|
||||||
|
|||||||
+19
-20
@@ -63,18 +63,22 @@ void FormField::onEvent(event_t event)
|
|||||||
|
|
||||||
void FormField::setFocus(uint8_t flag)
|
void FormField::setFocus(uint8_t flag)
|
||||||
{
|
{
|
||||||
if (!enabled) {
|
if (enabled) {
|
||||||
if (flag == SET_FOCUS_BACKWARD) {
|
Window::setFocus(flag);
|
||||||
if (previous)
|
|
||||||
previous->setFocus(flag);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (next)
|
|
||||||
next->setFocus(flag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Window::setFocus(flag);
|
clearFocus();
|
||||||
|
focusWindow = this;
|
||||||
|
if (flag == SET_FOCUS_BACKWARD) {
|
||||||
|
if (previous) {
|
||||||
|
previous->setFocus(flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (next) {
|
||||||
|
next->setFocus(flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,15 +137,6 @@ void FormGroup::setFocus(uint8_t flag)
|
|||||||
|
|
||||||
if (windowFlags & FORM_FORWARD_FOCUS) {
|
if (windowFlags & FORM_FORWARD_FOCUS) {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case SET_FOCUS_FIRST:
|
|
||||||
if (first) {
|
|
||||||
first->setFocus(SET_FOCUS_FIRST);
|
|
||||||
}
|
|
||||||
else if (next) {
|
|
||||||
next->setFocus(SET_FOCUS_FIRST);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SET_FOCUS_BACKWARD:
|
case SET_FOCUS_BACKWARD:
|
||||||
if (focusWindow->isChild(first)) {
|
if (focusWindow->isChild(first)) {
|
||||||
if (previous == this) {
|
if (previous == this) {
|
||||||
@@ -163,8 +158,12 @@ void FormGroup::setFocus(uint8_t flag)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SET_FOCUS_FIRST:
|
||||||
|
clearFocus();
|
||||||
|
// no break;
|
||||||
|
|
||||||
case SET_FOCUS_FORWARD:
|
case SET_FOCUS_FORWARD:
|
||||||
if (focusWindow->isChild(this)) {
|
if (focusWindow && focusWindow->isChild(this)) {
|
||||||
if (next == this) {
|
if (next == this) {
|
||||||
first->setFocus(SET_FOCUS_FORWARD);
|
first->setFocus(SET_FOCUS_FORWARD);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -62,9 +62,9 @@ class FormField: public Window {
|
|||||||
editMode = newEditMode;
|
editMode = newEditMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable(bool enabled = true)
|
void enable(bool value = true)
|
||||||
{
|
{
|
||||||
this->enabled = enabled;
|
enabled = value;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user