From 2e568b3e05aa2731310f215f75efa24e120c7951 Mon Sep 17 00:00:00 2001 From: forntoh Date: Sun, 18 Feb 2024 20:36:55 +0100 Subject: [PATCH] BugFix: Fixed `setText` and `getSubMenu` not working --- src/MenuItem.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MenuItem.h b/src/MenuItem.h index 96df3c86..4ec07906 100644 --- a/src/MenuItem.h +++ b/src/MenuItem.h @@ -129,7 +129,7 @@ class MenuItem { * Set the text of the item * @param text text to display for the item */ - void setText(const char* text){}; + void setText(const char* text) { this->text = text; }; /** * Set the callback on the item * @param callback reference to callback function @@ -153,7 +153,7 @@ class MenuItem { * Get item at index from the submenu * @param index for the item */ - MenuItem& operator[](const uint8_t index); + virtual MenuItem* operator[](const uint8_t index) { return NULL; }; }; #define ITEM_BASIC(...) (new MenuItem(__VA_ARGS__)) @@ -192,6 +192,8 @@ class ItemHeader : public MenuItem { : ItemHeader("", parent, MENU_ITEM_SUB_MENU_HEADER) {} MenuItem** getSubMenu() override { return this->parent; }; + + MenuItem* operator[](const uint8_t index) override { return parent[index]; } }; /**