ContextMenu: PP.Ui.Menu;
The ContextMenu property determines a component's context menu.
To execute the example, connect the PP.js library and the table of the PP.css visual styles. See below the Javascript code which is used to locate a button on the HTML page.
<script type="text/javascript">
var CMenu = new PP.Ui.Menu();//Create a menu consisting of two elements
CMenu.addItem("Open");
CMenu.addItem("Close");
var b1 = new PP.Ui.Button({//Create an instance of the Button class
ParentNode: document.getElementById("b1"),
Content: "Select",
ContextMenu: CMenu })//Set context menu for the button
</script>
After executing the example the HTML page contains a button named Select. Clicking the button with the right mouse button opens the context menu that looks as follows:
See also: