Pixl.js Menus

Pixl.js Menu

Pixl.js contains a simple menu system based on the graphical_menu module.

To use it just call Pixl.menu(...); with an object where each field's name corresponds to a menu item, and the value is a function that is executed when that item is selected.

To disable the menu, use Pixl.menu() - see the documentation

Source Code

// First menu
var mainmenu = {
  "" : {
    "title" : "-- Main Menu --"
  },
  "Backlight On" : function() { LED1.set(); },
  "Backlight Off" : function() { LED1.reset(); },
  "> Second Menu" : function() { Pixl.menu(submenu); },
  "Exit" : function() { Pixl.menu(); },
};

// Submenu
var submenu = {
  "" : {
    "title" : "-- SubMenu --"
  },
  "One" : undefined, // do nothing
  "Two" : undefined, // do nothing
  "< Back" : function() { Pixl.menu(mainmenu); },
};

Pixl.menu(mainmenu);

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.