This is a basic application of the ContextMenu class.
Click the button to Disable/Enable the Cut, Copy, & Paste menu items.
right click for demo
JavaScript
menu = new ContextMenu();
menu.addItem("open", "Open", itemAlert, "icons/folder.png");
menu.addItem("save", "Save", itemAlert, "icons/disk.png");
[...]
DEMO 2 : Dynamic Labels & Events
This demo uses functions instead of strings giving the items dynamic labels.
A border is also applied to the rectangle when the menu is shown, and removed when the menu is hidden.
right click for demo
JavaScript
menu = new ContextMenu();
menu.addItem("titleDate", "Today's Date", null, null, false);
menu.addItem("date", getCurrentDate, itemAlert, "icons/calendar.png");
[...]