ezMenu not declared in scope error
-
Hi all,
I'm trying to use advanced functions with ezMenu addItem. The only example I can find for it is in the M5ez.ccp file https://github.com/ropg/M5ez/blob/master/src/M5ez.cpp line 1248.
So in my main.ino file I have
void mainmenu_manage_boards() { // TODO prefs.begin("BOARDSTATUS"); String idx; ezMenu savedBoards("Managing Boards"); if (board_count < 1) { ez.msgBox("No Boards", "You have no saved Boards.", "OK"); return; } for (uint8_t n = 1; n < board_count+1; n++) { idx = "NAME" + (String)n; String name = prefs.getString(idx.c_str(), ""); savedBoards.addItem(name, NULL, _savedSelected); } savedBoards.txtSmall(); savedBoards.buttons("up#Back#Forget##down#"); savedBoards.run(); prefs.end(); } bool _savedSelected(ezMenu* callingMenu) { if (callingMenu->pickButton() == "Forget") { if (ez.msgBox("Forgetting board", "Are you sure you want | to forget board | " + callingMenu->pickName() + " ?", "Yes##No") == "Yes") { callingMenu->deleteItem(callingMenu->pick()); } } return false; }
On compile I get the following error
error: 'ezMenu' was not declared in this scope static bool _savedSelected(ezMenu* callingMenu) {
Any suggestions? If I do
savedBoards.addItem(name, NULL, NULL);
The menu renders fine.
Thanks in advance.
-
Which version are you using? perhaps updating to the latest version in library manager will solve it. Otherwise I can't suggest anything as I never used M5EZ, but did you read the manual https://github.com/ropg/M5ez
-
@lukasmaximus thanks for the reply. Yeah I'm using the latest version 2.1.2 and have read the manual several times in places ha ha.
So after messing around with it for too long last night this morning I figured I would try compiling it in the Arduino IDE rather than the VSCode Arduino extension that I have been using up until now.
And it works! Obviously something going wrong with the extension. I will report the issue on their github.
-
I'm going to be cheeky here and say if this is Arduino then look at the first line of your code.
Hint its whats not there that is the issue.