Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Copy nodes with their subordinates and links (Read 1927 times)
alinp75
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Aug 24th, 2010
Copy nodes with their subordinates and links
Aug 24th, 2010 at 4:11pm
Print Post  
Hi, I have version 5.3.5.25867 of the Diagram control. I want to build some functionality that will allow the user to click a node and copy that node including all its subordinates so that iit can be pasted as a child of another node on the same or a different diagram.

I was looking at the copyselection but we are preventing the user to select the links so the paste will just paste the nodes and not the links.

Clone of a ShapeNode (DiagramItem) will clone the node and not the subordinate nodes....

Please help,
Alin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Copy nodes with their subordinates and links
Reply #1 - Aug 24th, 2010 at 4:58pm
Print Post  
Hi,

I can add this (copying of a DiagramItemCollection) to our feature request list. For now you might clone the whole diagram by calling LoadFromString(SaveToString()), select in the second diagram all items that should be duplicated, and copy them to the original via the selection-copy methods.

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


I love YaBB 1G - SP1!

Posts: 2
Joined: Aug 24th, 2010
Re: Copy nodes with their subordinates and links
Reply #2 - Aug 24th, 2010 at 5:13pm
Print Post  
thanks for the quick reply. I'm going to try that...

Question - how do I progarmatically select a node and all the subordinate nodes? How do I navigate the subordinate links/nodes and add them to the selection?

Question - How would I connect the first node of the selection to my destination node? Can I use AttachTo?

Thanks a lot
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Copy nodes with their subordinates and links
Reply #3 - Aug 24th, 2010 at 5:29pm
Print Post  
Loop over the items returned by node.Query("children") and node.Query("links") and set their Selected property.

Yes, you can use AttachTo if what you need is to make the copied node a subordinate in another group.

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