Skip to content

Commit

Permalink
BugFix: Fixed setText and getSubMenu not working
Browse files Browse the repository at this point in the history
  • Loading branch information
forntoh committed Feb 18, 2024
1 parent 5dc3d1c commit 2e568b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/MenuItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__))

Expand Down Expand Up @@ -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]; }
};

/**
Expand Down

0 comments on commit 2e568b3

Please sign in to comment.