Just a simple module for perhaps making Plus Menus easier to create.
Download Module: util_MsgPlus.js
Example Usage:
Generating the Menu
code:
function OnGetScriptMenu(){
//Create new menu
var myMenu = new PlusMenu;
//Populate menu
//Add a menu item
myMenu.addItem("mnuItem1", "Item #1");
myMenu.addItem("mnuItem2", "Item #2", false); //Disabled menu item
//Add a separator because separators are pretty cool...
myMenu.addSeparator();
//Create a sub menu
myMenu.openSubMenu("My 1st Sub Menu!");
//Add a menu item to the sub menu
myMenu.addItem("mnuItem3", "Item #3");
myMenu.closeSubMenu();
//Create a disabled sub menu
myMenu.openSubMenu("My 2nd Sub Menu!", false);
myMenu.closeSubMenu();
//Build menu
return myMenu.build();
}
Detecting when a menu item is clicked
code:
function OnEvent_MenuClicked(sMenuId){
if(sMenuId=="mnuItem1"){
MsgPlus.DisplayToast("Menu Click", "Menu Item #1 was clicked!");
}
}