You are reading a single comment by @myownself and its replies. Click here to read the full conversation.
  • @myownself I don't think that's a good idea I'm afraid - if you imagine something like the Settings app, it means that it'd have to have every menu loaded into RAM at once. We really need the functions. We could have "Submenu" : { submenu: function() { ... } }, though I guess.

    Or, maybe we just detect > on the end of the string, a bit like:

    var mainmenu = {
      "" : { "title" : "Main Menu" },
      "< Back" : function() { print("Back") },
      "Submenu >" : function() { E.showMenu(submenu); },
    };
    

    Then it's kind of obvious from the code what it's going to look like anyway.

    @malaire thanks - looks like something got broken as it worked in earlier firmwares. I've just fixed it now.

    Not sure what you mean by:

    Also pressing button does nothing in that menu, i.e. it doesn't go back to previous menu.

    though

  • if you imagine something like the Settings app, it means that it'd have to have every menu loaded into RAM at once. We really need the functions. We could have "Submenu" : { submenu: function() { ... } }, though I guess.

    Ah, ok. I thought about it accepting either the object or a function, but looking through my blinkers at the original gist I didn't think about the need memory issue.

    Personally I don't exactly love using the label for this (nor the back button, not sure about the memory issue, but I'd have been tempted to have parent menu as an optional parameter to E.showMenu rather than needing to put it explicitly in the submenu). Does using the label add any confusion for translations? At the end of the day, though, the important thing is the distinction between submenu and action.

About

Avatar for myownself @myownself started