fix focus for menus. Focus is still broken.
This commit is contained in:
committed by
Raphael Coeffic
parent
9d45303531
commit
5260f61530
+2
-4
@@ -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
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user