You are reading a single comment by @Gordon 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.

  • 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

    I meant that if I go to Settings > Bluetooth > HID and then decide that I don't want to change it after all then I can't get back by pressing the button, I need to re-select the option that is currently selected to get back.

    But actually I'm not sure if button is even intended to work there.

About

Avatar for Gordon @Gordon started