Skip to content

Commit

Permalink
fix(color): TELE navigation issue when editing top bar widgets (#4344)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored Nov 21, 2023
1 parent af43536 commit 1b6b1f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 1 addition & 2 deletions radio/src/gui/colorlcd/screen_user_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ void ScreenUserInterfacePage::build(FormWindow* window)
auto line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_TOP_BAR, 0, COLOR_THEME_PRIMARY1);

auto menu = this->menu;
auto setupTopbarWidgets = new TextButton(line, rect_t{}, STR_SETUP_WIDGETS);
setupTopbarWidgets->setPressHandler([menu]() -> uint8_t {
setupTopbarWidgets->setPressHandler([=]() -> uint8_t {
menu->deleteLater();
new SetupTopBarWidgetsPage();
return 0;
Expand Down
16 changes: 16 additions & 0 deletions radio/src/gui/colorlcd/topbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,19 @@ void SetupTopBarWidgetsPage::deleteLater(bool detach, bool trash)

storageDirty(EE_MODEL);
}

void SetupTopBarWidgetsPage::onEvent(event_t event)
{
#if defined(HARDWARE_KEYS)
if (event == EVT_KEY_FIRST(KEY_PAGEUP) || event == EVT_KEY_FIRST(KEY_PAGEDN) ||
event == EVT_KEY_FIRST(KEY_SYS) || event == EVT_KEY_FIRST(KEY_MODEL)) {
killEvents(event);
} else if (event == EVT_KEY_FIRST(KEY_TELE)) {
onCancel();
} else {
FormWindow::onEvent(event);
}
#else
FormWindow::onEvent(event);
#endif
}
1 change: 1 addition & 0 deletions radio/src/gui/colorlcd/topbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ class SetupTopBarWidgetsPage : public FormWindow

void onClicked() override;
void onCancel() override;
void onEvent(event_t event) override;
void deleteLater(bool detach = true, bool trash = true) override;
};

0 comments on commit 1b6b1f0

Please sign in to comment.