diff --git a/radio/src/gui/colorlcd/radio_sdmanager.cpp b/radio/src/gui/colorlcd/radio_sdmanager.cpp index 217d44612..b6508458e 100644 --- a/radio/src/gui/colorlcd/radio_sdmanager.cpp +++ b/radio/src/gui/colorlcd/radio_sdmanager.cpp @@ -211,6 +211,28 @@ class FlashDialog: public FullScreenDialog Progress progress; }; +class SDmanagerButton : public TextButton +{ + public: + SDmanagerButton(FormGroup* parent, const rect_t& rect, std::string text, + std::function pressHandler = nullptr, + WindowFlags windowFlags = BUTTON_BACKGROUND | OPAQUE, + LcdFlags textFlags = 0 ) : TextButton(parent, rect, text, pressHandler, windowFlags, textFlags) + { + }; +#if defined(HARDWARE_TOUCH) + bool onTouchStart(coord_t x, coord_t y) override + { + if (enabled) { + if (!(windowFlags & NO_FOCUS)) { + setFocus(SET_FOCUS_DEFAULT); + } + } + return true; + } +#endif +}; + void RadioSdManagerPage::build(FormWindow * window) { FormGridLayout grid; @@ -250,7 +272,7 @@ void RadioSdManagerPage::build(FormWindow * window) files.sort(compare_nocase); for (auto name: directories) { - auto b = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { + auto b = new SDmanagerButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { std::string fullpath = currentPath + "/" + name; f_chdir((TCHAR*)fullpath.c_str()); window->clear(); @@ -262,7 +284,7 @@ void RadioSdManagerPage::build(FormWindow * window) } for (auto name: files) { - auto button = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { + auto button = new SDmanagerButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { auto menu = new Menu(window); f_chdir(currentPath.c_str()); const char *ext = getFileExtension(name.data());