🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    ezMenu not declared in scope error

    M5EZ
    3
    4
    9.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      richardmckenna
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • lukasmaximusL
        lukasmaximus
        last edited by

        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

        R 1 Reply Last reply Reply Quote 0
        • R
          richardmckenna @lukasmaximus
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3
            last edited by ajb2k3

            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.

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post