Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to get shape node Name or ID from DiagramView.Diagram object (Read 4147 times)
umesh
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Dec 29th, 2011
how to get shape node Name or ID from DiagramView.Diagram object
Dec 29th, 2011 at 11:30am
Print Post  
In order to map the canvas objects to programming objects we need to identify which objects are dropped on the canvas. Is any sample available demonstrating this ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to get shape node Name or ID from DiagramView.Diagram object
Reply #1 - Dec 29th, 2011 at 11:59am
Print Post  
Hi,

You could use the nodes' Text or Id property to identify objects, e.g. assign to them from NodeCreated or NodeCreatedScript handlers, or enable AllowInplaceEdit to let users set Text by double-clicking. Then you can iterate over Diagram.Nodes and check the respective property:

Code
Select All
foreach (ShapeNode node in diagView.Diagram.Nodes)
      Debug.WriteLine(node.Text + " is on the canvas.");
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
umesh
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Dec 29th, 2011
Re: how to get shape node Name or ID from DiagramView.Diagram object
Reply #2 - Dec 30th, 2011 at 8:04am
Print Post  
Hi Stoyan,

Thanks for the reply for the query I posted above.

As mentioned in the response I have added the following code and it’s not getting called anytime and also ID or text not getting set.

protected void paletteView_NodeCreated(object sender, NodeEventArgs e)
{
foreach (ShapeNode oNode in canvasView.Diagram.Nodes)
{
oNode.Id = System.Guid.NewGuid().ToString(); // to test assigning the GUID, it will be replaced with actual ID
oNode.Text = System.Guid.NewGuid().ToString();// to test assigning the GUID, it will be replaced with actual Text
}
}

Due to the business requirement, I can’t use the third option of allowing the user to input the text on the object placed on the canvas and collect it on the server side.

Regards,
Umesh V
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to get shape node Name or ID from DiagramView.Diagram object
Reply #3 - Dec 30th, 2011 at 8:16am
Print Post  
Hi,

Server side NodeCreated events are raised only in ImageMap mode. If using JavaApplet or Canvas modes, set NodeCreatedScript to the name of a JavaScript function that should handle the event and assign Id and Text from that function. You could also call a web service to get an id from the server if this cannot be processed directly on the client side. Calling services from client-side event handlers is shown in the OrgBrowser sample project.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint