🤖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

    Scheduled Pinned Locked Moved M5EZ
    4 Posts 3 Posters 11.9k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post