Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Prevent self linking (Read 1562 times)
digit
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Jul 23rd, 2008
Prevent self linking
Sep 11th, 2008 at 5:14am
Print Post  
How do I prevent a user from linking a node to its self?

I have tried handling Diagram.LinkCreating with following code:

       ' cancel if linking to self
       If e.Link.Origin Is e.Link.Destination Then
           e.Cancel = True
       End If

This doesnt seem to work though.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Prevent self linking
Reply #1 - Sep 11th, 2008 at 7:39am
Print Post  
To prevent that for all nodes in the diagram, set Diagram.AllowSelfLoops = false. To do that for a specific node using an event handler, compare LinkValidationEventArgs.Origin with LinkValidationEventArgs.Destination, instead of DiagramLink.Origin with DiagramLink.Destination.

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


I love YaBB 1G - SP1!

Posts: 12
Joined: Jul 23rd, 2008
Re: Prevent self linking
Reply #2 - Sep 11th, 2008 at 8:34am
Print Post  
Thanks - that worked Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint