onFocusLost calls now focusHandler(false) when this handler is set

This commit is contained in:
Bertrand Songis
2020-04-28 10:09:38 +02:00
parent 7e398b2e9f
commit 041c26afb4
4 changed files with 10 additions and 4 deletions
+3 -1
View File
@@ -45,8 +45,10 @@ class CommonInputOrMixButton : public Button {
Button(parent, rect), Button(parent, rect),
index(index) index(index)
{ {
setFocusHandler([=]() { setFocusHandler([=](bool active) {
if (active) {
bringToTop(); bringToTop();
}
}); });
} }
+3 -1
View File
@@ -257,8 +257,10 @@ class ModelCategoryPageBody: public FormWindow {
for (auto & model: * category) { for (auto & model: * category) {
auto button = new ModelButton(this, {x, y, MODEL_SELECT_CELL_WIDTH, MODEL_SELECT_CELL_HEIGHT}, model, nullptr); auto button = new ModelButton(this, {x, y, MODEL_SELECT_CELL_WIDTH, MODEL_SELECT_CELL_HEIGHT}, model, nullptr);
button->setFocusHandler([=] { button->setFocusHandler([=](bool active) {
if (active) {
footer->setCurrentModel(model); footer->setCurrentModel(model);
}
}); });
button->setPressHandler([=]() -> uint8_t { button->setPressHandler([=]() -> uint8_t {
+3 -1
View File
@@ -257,8 +257,10 @@ void RadioSdManagerPage::build(FormWindow * window)
} }
return 0; return 0;
}, 0); }, 0);
button->setFocusHandler([=]() { button->setFocusHandler([=](bool active) {
if (active) {
preview->setFile(getFullPath(name)); preview->setFile(getFullPath(name));
}
}); });
grid.nextLine(); grid.nextLine();
} }