Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Iterating Links (Read 4898 times)
gringogordo
YaBB Newbies
*
Offline


Flowcharting is my life
baby

Posts: 12
Joined: Nov 13th, 2007
Iterating Links
Nov 15th, 2007 at 3:00pm
Print Post  
Hi,

I am writing a proc to delete all subordinate nodes and links if a shapenode is deleted (I don't know if there is a method already ? )

I can't seem to pick up the links - am I misunderstanding something.  I have now got it down to a diagram with 2 nodes and a link.  If I save the diagram to XML the link is there  (see below) vowever none of the methods, properties or collections seem to pick it up.  I was going to use OutgoingLinks but GetAlLinks also has a count of 0?  Have I misunderstood ?

Thanks,

GG


XML for link
-------------------------------------------------------
<Origin Id="1" ClassId="std:ShapeNode" Version="1" />
     <OriginRelative>50, 100</OriginRelative>
     <OriginAnchor>1</OriginAnchor>
     <Destination Id="2" ClassId="std:ShapeNode" Version="1" />
     <DestinationRelative>50, 0</DestinationRelative>
     <DestinationAnchor>0</DestinationAnchor>

----------------------------------------------------------------
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Iterating Links
Reply #1 - Nov 15th, 2007 at 4:22pm
Print Post  
Hi,

Deleting a node automatically deletes all links related to it, so you should not need to delete them explicitly. If you need to delete all items in a subordinate group, you can just set mainNode.SubordinateGroup.AutoDeleteItems = true and the control will delete the subordinated items for you when mainNode is deleted.

Stoyan
  
Back to top
 
IP Logged
 
gringogordo
YaBB Newbies
*
Offline


Flowcharting is my life
baby

Posts: 12
Joined: Nov 13th, 2007
Re: Iterating Links
Reply #2 - Nov 16th, 2007 at 11:52am
Print Post  
Hi,

This doesn't seem to work for me.  I am using FlowChart.Net Demo and basing my current work on the FlowCharter sample.  I have changed it quite a bit but the creation events _view.DragDrop and fc_LinkCreated (_doc.LinkCreated) are pretty much as found.  Is there a reason why I the links don't seem to be registering ? (OutgoingLinks, GetAlLinks, Incoming Links all ave counts of 0 even when there are links) and the SubordinateGroup.AutoDeleteItems = true doesn't seem to work. 

Is this because they are being created as shapenodes maybe (_doc.Factory.CreateShapeNode(pt.X, pt.Y, 20, 20)) ??

Thanks...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Iterating Links
Reply #3 - Nov 16th, 2007 at 12:02pm
Print Post  
Hi,

At what point are you trying to access the node's links? If you are doing that in a NodeDeleted event handler, it might be too late, because the control first deletes all related links automatically.

Stoyan
  
Back to top
 
IP Logged
 
gringogordo
YaBB Newbies
*
Offline


Flowcharting is my life
baby

Posts: 12
Joined: Nov 13th, 2007
Re: Iterating Links
Reply #4 - Nov 16th, 2007 at 1:41pm
Print Post  
Doh!  Yes you are right, I put the count in a context menuitem and it comes back correctly - I'll look at this some more at finding the rigt place to do this.

Could you tell me though, is there something I have to do to create the Subordinate group ?  I have a context menu item which shows details on the parent node (node a) of a particular node (node b).  When I try to access the subordinate group of node a or the master group of node b they are 'nothing'.  Also I have added the line b.SubordinateGroup.AutoDeleteItems = True to _view.Dragdrop but this doesn't force a recursive delete and I added _doc.Selection.Nodes(0).SubordinateGroup.AutoDeleteItems = True to _menuItemDelete_Click - still no joy!

Cheers...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Iterating Links
Reply #5 - Nov 16th, 2007 at 2:23pm
Print Post  
SubordinateGroup and MasterGroup are null until you create a group by calling subordinateNode.AttachTo(masterNode, ...). After that, the masterNode.SubordinateGroup will refer to a Group instance, and subordinateNode.MasterGroup will refer to the same group.

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


Flowcharting is my life
baby

Posts: 12
Joined: Nov 13th, 2007
Re: Iterating Links
Reply #6 - Nov 16th, 2007 at 2:40pm
Print Post  
It does indeed.  Thanks for your help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Iterating Links
Reply #7 - Nov 16th, 2007 at 8:46pm
Print Post  
{ moved from FlowChartX / Discussion }
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint