Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic inscrutable LinkValidationEventArgs (Read 1500 times)
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
inscrutable LinkValidationEventArgs
May 13th, 2011 at 5:03pm
Print Post  
Hi,

I have ShapeNodes with AnchorPoints that can hold either incoming or outgoing links.

When the user tries to create a link I control the LinkValidationEvent in order to find out if there is a free AnchorPoint for outgoing links available.
I just count the number of free AnchorPoints for outgoing links and cancel the event when zero.

The data in the LinkValidationEventArgs seem to be correct:
Origin and Node both represent the same ShapeNode where the link should start.
Destination=null
ChangingOrigin=true
ChangingDesitination=false

Then the user enters a destination ShapeNode.
The LinkValidationEventArgs seems to hold strange data:

Origin and Node both represent the same ShapeNode where the link should end.
I would expect Destination to be the ShapeNode representing the end of the link.
But Destination=null.
Also I would expect ChangingOrigin to be false and ChangingDesitination to be true (since I am here at the destination of the link).
But it is the other way around:
ChangingOrigin=true
ChangingDesitination=false

How can I understand the LinkValidationEventArgs?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: inscrutable LinkValidationEventArgs
Reply #1 - May 14th, 2011 at 9:46am
Print Post  
Hi,

Do you mean the ValidateAnchorPoint event? If so, does this asserts for you?

Code
Select All
private void diagram_ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
{
	if (e.ChangingOrigin)
		Debug.Assert(e.Origin == e.Node);
	if (e.ChangingDestination)
		Debug.Assert(e.Destination == e.Node);
} 



Note that ValidateAnchorPoint could be raised both for the origin and destination nodes, even if the mouse is currently over the destination. E.g. this would happen if link.Dynamic is enabled and you complete drawing the link, or if you move one of the nodes the event will be raised for both to update the dynamic link end points.

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