You are reading a single comment by @rigrig and its replies. Click here to read the full conversation.
  • Another option: maybe support format on functions:

          // L295: changed from
          //   } else if ("function" == typeof item) {
         //        g.drawImage(/* 9x18 */atob("CRKBAGA4Hg8DwPB4HgcDg8PB4eHg8HAwAA=="), r.x+r.w-21, r.y+H/2-9);
         //        pad += 16;
          } else if ("function" == typeof item && item.format) {
            var l=item.format(item.value);
            g.setFontAlign(1,0).drawString(l,r.x+r.w-8,r.y+H/2);
            pad += g.stringWidth(l);
          }
    ...
    var mainmenu = {
    ...
      "A menu item" : function() { LED1.toggle(); },
      "Submenu" : function() { E.showMenu(submenu); },
    ...
    };
    mainmenu.Submenu.format= ()=>'\0'+atob("CRKBAGA4Hg8DwPB4HgcDg8PB4eHg8HAwAA==");
    

    Sadly this means you can't just use a single object as menu definition :-(

    Edit: or how about we just look if the label ends with ">"? It would require app changes, but nothing breaking.

About

Avatar for rigrig @rigrig started