Merge branch 'menu-default-select'
This commit is contained in:
+5
-4
@@ -122,11 +122,7 @@ class MenuBody: public Window
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<MenuLine> lines;
|
std::vector<MenuLine> lines;
|
||||||
#if defined(HARDWARE_TOUCH)
|
|
||||||
int selectedIndex = -1;
|
|
||||||
#else
|
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 0;
|
||||||
#endif
|
|
||||||
std::function<void()> onCancel;
|
std::function<void()> onCancel;
|
||||||
|
|
||||||
inline Menu * getParentMenu();
|
inline Menu * getParentMenu();
|
||||||
@@ -185,6 +181,11 @@ class Menu: public ModalWindow
|
|||||||
waitHandler = std::move(handler);
|
waitHandler = std::move(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setFocusBody(uint8_t flag = SET_FOCUS_DEFAULT)
|
||||||
|
{
|
||||||
|
content->body.setFocus(flag);
|
||||||
|
}
|
||||||
|
|
||||||
void setToolbar(Window * window)
|
void setToolbar(Window * window)
|
||||||
{
|
{
|
||||||
toolbar = window;
|
toolbar = window;
|
||||||
|
|||||||
@@ -156,9 +156,11 @@ class MenuToolbar: public FormGroup {
|
|||||||
choice->fillMenu(menu, [=](int16_t index) {
|
choice->fillMenu(menu, [=](int16_t index) {
|
||||||
return index >= filtermin && index <= filtermax;
|
return index >= filtermin && index <= filtermax;
|
||||||
});
|
});
|
||||||
|
menu->setFocusBody();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
choice->fillMenu(menu);
|
choice->fillMenu(menu);
|
||||||
|
menu->setFocusBody();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user