<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="MindFusion.Diagramming.WebForms" Namespace="MindFusion.Diagramming.WebForms" TagPrefix="ndiag" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function onNodeClicked(sender, args)
{
if (args.getMouseButton() == 3)
showContextMenu(args.getNode(), args.getMousePosition());
var menu = null;
var currentNode;
function showContextMenu(node, mousePos)
{
var applet = <%= diagramView.AppletElement %>;
var scriptHelper = applet.getScriptHelper();
var diagView = applet.getDiagramView();
var diagram = diagView.getDiagram();
currentNode = node;
if (!menu)
{
menu = diagram.getFactory().createTableNode(mousePos.getX(), mousePos.getY(), 20, 20);
menu.setRowCount(2);
menu.setColumnCount(1);
menu.getCell(0, 0).setText("Properties");
//menu.getCell(0, 1).setText("Add Order");
menu.setCaptionHeight(0);
menu.setCaption("");
menu.resizeToFitText(true);
menu.setCellFrameStyle(1);
menu.setBrush(scriptHelper.createSolidBrush(255, 255, 255));
}else
{
menu.setVisible(true);
menu.moveTo(mousePos.getX(), mousePos.getY());
}
}
var node = args.getNode();
node.setText("edit me!");
<%=diagramView.AppletElement%>.getDiagramView().beginEdit(node);
//function onCellClicked(sender, args)
//{// if (args.getCell().getText() == "Properties")
// {
myRef = window.open('Windows.aspx?PageFlag=' + document.getElementById("tbFileName").value,'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
//}
//}
}
function onNodeCreated(sender, args){
args.getNode().setTag(getUniqueId());
//var node = args.getNode();
//node.setText("edit me!");
//<%=diagramView.AppletElement%>.getDiagramView().beginEdit(node);
}
function getUniqueId(){
var dateObject = new Date();
var uniqueId = dateObject.getFullYear() + "" + dateObject.getMonth() + "" +
dateObject.getDate() + "" +
dateObject.getTime();
//alert(uniqueId);
//return uniqueId;
document.getElementById("tbFileName").value=uniqueId;
}
function ontextedit(sender, args){
var node = args.getNode();
node.setText("edit me!");
<%=diagramView.AppletElement%>.getDiagramView().beginEdit(node);
}
function addShapesToList(shapelistApplet, shapeIdArray)
{
var scriptHelper = shapelistApplet.getScriptHelper();
var shapeList = shapelistApplet.getShapeListBox();
for (i = 0; i < shapeIdArray.length; ++i)
{
var shape = scriptHelper.shapeFromId(shapeIdArray[i]);
shapeList.addShape(shape);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Style="left: 10px;
position: absolute; top: 685px" Text="Save" Width="111px" />
<asp:Button ID="btnLoad" runat="server" OnClick="btnLoad_Click" Style="left: 354px;
position: absolute; top: 685px" Text="Load" Width="111px" />
<asp:TextBox ID="tbFileName" runat="server" Style="left: 127px; position: absolute;
top: 685px">untitled.fc</asp:TextBox>
<asp:DropDownList ID="listFileNames" runat="server" Style="left: 472px; position: absolute;
top: 685px" Width="171px">
</asp:DropDownList>
<ndiag:DiagramView ID="diagramView" runat="server" Style="left: 4px; width: 650px;
position: absolute; top: 3px; height: 650px" NodeDoubleClickedScript="onNodeClicked" NodeCreatedScript="onNodeCreated" NodeModifiedScript="ontextedit" ModificationStart="AutoHandles" BackColor="Blue" BorderColor="Cyan" Font-Bold="True" Font-Names="Arial" Font-Size="Large" InplaceEditFont="Arial, 15.75pt, style=Bold" AppletStartedScript="addShapesToList" >
<Diagram RowHighlightBrush="s:#FFB9D1EA" />
</ndiag:DiagramView>
<ndiag:ShapeListBox ID="shapeList" runat="server" Style="left: 656px; width: 160px;
position: absolute; top: -4px; height:650px; background-color: white" AllowRemove="True" BackColor="Olive" BorderColor="Blue" Font-Bold="False" Font-Size="Medium" ForeColor="Cyan" ShapeFillColor="White" AppletStartedScript="addShapesToList" />
<ndiag:Overview ID="ovw" runat="server" DiagramViewID="diagramView" Style="left: 650px; width: 160px;
position: absolute; top: 650px; height: 160px" />
</div>
</form>
</body>
</html>
[/code]
can you suggetsme how can it works
We used one method addShapesToList in AppletStartedScript event of shapelist.But how can i add or remove the new shape in to my shapelist.hwhat are the next steps w e need to folow and how can it works..thank you so much for your time