Choice / Menu simplified by using the layers

This commit is contained in:
Bertrand Songis
2020-11-27 14:56:19 +01:00
parent 38641c7cfc
commit 77a4379bb2
2 changed files with 3 additions and 9 deletions
+1 -5
View File
@@ -160,11 +160,7 @@ void Choice::openMenu()
} }
menu->setCloseHandler([=]() { menu->setCloseHandler([=]() {
editMode = false; setEditMode(false);
auto focus = getFocus();
if (focus && focus->isChild(menu)) {
setFocus(SET_FOCUS_DEFAULT);
}
}); });
setEditMode(true); setEditMode(true);
+2 -4
View File
@@ -55,8 +55,8 @@ void MenuBody::onEvent(event_t event)
menu->invalidate(); menu->invalidate();
} }
else { else {
lines[selectedIndex].onPress();
menu->deleteLater(); menu->deleteLater();
lines[selectedIndex].onPress();
} }
} }
} }
@@ -86,12 +86,10 @@ bool MenuBody::onTouchEnd(coord_t /*x*/, coord_t y)
menu->invalidate(); menu->invalidate();
} }
else { else {
menu->deleteLater();
lines[index].onPress(); lines[index].onPress();
} }
} }
if (!menu->multiple) {
menu->deleteLater();
}
return true; return true;
} }
#endif #endif