fix focus for menus. Focus is still broken.

This commit is contained in:
kkoenig1@optonline.com
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent 9d45303531
commit 5260f61530
2 changed files with 3 additions and 4 deletions
+2 -4
View File
@@ -184,6 +184,8 @@ void Choice::onEvent(event_t event)
void Choice::openMenu() void Choice::openMenu()
{ {
setEditMode(true); // this needs to be done first before menu is created.
auto menu = new Menu(this); auto menu = new Menu(this);
if (!menuTitle.empty()) if (!menuTitle.empty())
menu->setTitle(menuTitle); menu->setTitle(menuTitle);
@@ -224,13 +226,9 @@ void Choice::openMenu()
beforeDisplayMenuHandler(menu); beforeDisplayMenuHandler(menu);
} }
menu->setCloseHandler([=]() { menu->setCloseHandler([=]() {
setEditMode(false); setEditMode(false);
}); });
setEditMode(true);
invalidate();
} }
#if defined(HARDWARE_TOUCH) #if defined(HARDWARE_TOUCH)
+1
View File
@@ -52,6 +52,7 @@ MenuBody::MenuBody(Window * parent, const rect_t & rect):
Window(parent, rect, OPAQUE, 0, lv_list_create) Window(parent, rect, OPAQUE, 0, lv_list_create)
{ {
setPageHeight(MENUS_LINE_HEIGHT); setPageHeight(MENUS_LINE_HEIGHT);
setFocus();
} }
void MenuBody::addLine(const std::string &text, std::function<void()> onPress, void MenuBody::addLine(const std::string &text, std::function<void()> onPress,