Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Deleting linked nodes (Read 2613 times)
lolo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Aug 26th, 2005
Deleting linked nodes
Sep 23rd, 2005 at 5:54am
Print Post  
Hi, say i have 5 nodes linked together, and if i delete the 1st nodes, the remaining 4 nodes plus the arrows connecting themm should be remove. but i have a problem doing that. Please help

my code is :
       For Each node In ChildList
           node.OutgoingArrows.Clear()   
           node.IncomingArrows.Clear()
       Next

'node' is the node to be deleted
'childlist' is the queue of the 5 nodes
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Deleting linked nodes
Reply #1 - Sep 23rd, 2005 at 9:42am
Print Post  
Hi,

Use the flowchart's DeleteObject method to delete nodes. When a node is deleted, all arrows connected to it are deleted automatically so you don't have to deal explicitly with them.

Don't try to delete objects by removing them from a collection that contains them, but use DeleteObject because an item can be contained in several collections. E.g. an arrow is referenced by flowchart.Objects, flowchart.Arrows, aNode.IncomingArrows, otherNode.OutgoingArrows collections. Also DeleteObject takes care of saving undo/redo information and redrawing the invalid part of the diagram.

.NET does not allow to remove items from collections while they are enumerated using 'for each', so you could use the following:

while ChildList.Count > 0 do
  fc.DeleteObject(ChildList[ChildList.Count-1])

HTH
Stoyan
  
Back to top
 
IP Logged
 
lolo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Aug 26th, 2005
Re: Deleting linked nodes
Reply #2 - Sep 23rd, 2005 at 10:08am
Print Post  
Stoyo...It works. Thanks for the advice Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint