Category / Section
Is it possible to have the context menu by right clicking the node?
1 min read
Display context menu on a selected Node
It is possible to display context menu on a selected node. To display the context menu on the selected node and add it to new nodes, following JavaScript should be used.
// To display the contextmenu function attachevent() { document.getElementById('DiagramWebControl1').oncontextmenu=function() { PosX = ConvertXYToDocument( Diagram.GetRootElement(), event.clientX, event.clientY, Diagram.GetMagnification() ).x; PosY = ConvertXYToDocument( Diagram.GetRootElement(), event.clientX, event.clientY, Diagram.GetMagnification() ).y; Popup.ShowPopup(event.clientX, event.clientY); return false; }; } function OnContextMenuClick(Obj) { if(Obj.Text!="Edit") { Diagram.Refresh(Obj.Text+"|"+PosX+''|''+PosY); } else if(IsNodeSelected) { alert(''Not implemented'') } else { alert("Please select a Node to Edit"); } return false; }