Merge branch 'menu-default-select'

This commit is contained in:
Raphael Coeffic
2021-06-07 10:44:42 +02:00
2 changed files with 7 additions and 4 deletions
+5 -4
View File
@@ -122,11 +122,7 @@ class MenuBody: public Window
protected:
std::vector<MenuLine> lines;
#if defined(HARDWARE_TOUCH)
int selectedIndex = -1;
#else
int selectedIndex = 0;
#endif
std::function<void()> onCancel;
inline Menu * getParentMenu();
@@ -185,6 +181,11 @@ class Menu: public ModalWindow
waitHandler = std::move(handler);
}
void setFocusBody(uint8_t flag = SET_FOCUS_DEFAULT)
{
content->body.setFocus(flag);
}
void setToolbar(Window * window)
{
toolbar = window;
+2
View File
@@ -156,9 +156,11 @@ class MenuToolbar: public FormGroup {
choice->fillMenu(menu, [=](int16_t index) {
return index >= filtermin && index <= filtermax;
});
menu->setFocusBody();
}
else {
choice->fillMenu(menu);
menu->setFocusBody();
}
return 1;
});