In Appcelerator Titanium, setting up a menu is very easy. The menu system works with Titanium.UI and the Menu object.

To create a new menu object, all you have to do is:

   var menu = Titanium.UI.createMenu();

Now, a menu without any menu items is a rather useless feature, so now we need to add some menu items.

   var file = menu.addSubMenu("File");
   var help = menu.addSubMenu("Help");
   file.addItem("Open", function () { alert('Do open');});
   file.addItem("Exit", function () { Titanium.App.exit(); });

   help.addItem("About", function () { alert('Show about box here');  });

The menu.addSubMenu(textToDisplay) function adds a submenu to the menu, and returns the submenu object. Menu items are then added to the submenu with the .addItem(textToDisplay, functionToExecute). You can, of course, add submenus to a submenu in the same way as a submenu is added to the main menu.

The last step is to tell Titanium that you want to display the menu, and that is done with this command:


That is all there is to it. Nothing hard about it at all. For the full list of methods for the Menu object see the Titanium API Documentation.