Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Cannot create outgoing or incoming links (Read 5709 times)
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Cannot create outgoing or incoming links
Jul 15th, 2009 at 11:02am
Print Post  
Hey,
I have having an annoying problem.

I am using WPFDiagram version 2.1.2.26299

I create the new node this way:
Code
Select All
Point position = new Point((node.Bounds.Left * diagram.ZoomFactor / 100) + nodeWidth + 100,
                                    node.Bounds.Top * diagram.ZoomFactor / 100 + nodeHeight / 2);

Size nodeSize = new Size(nodeWidth, nodeHeight);

newNode = d.Factory.CreateTableNode(position, nodeSize);

DiagramLink newLink = diagram.Factory.CreateDiagramLink(originNode, newNode);
 



Creating it works find. The generated links works well.

When I try to add a new link thru the UI, it will not allow me.
The properties are:
* AllowIncomingLink = true
* AllowOutgoingLink = true
* AllowDrop = true
* Lock = false

I can add new nodes by dragging them onto the diagram and I am able to add links to these. Just not to the nodes I create programmatically.

I can't figure it out.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cannot create outgoing or incoming links
Reply #1 - Jul 15th, 2009 at 12:56pm
Print Post  
Is Diagram.Behavior set to LinkTables?
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Cannot create outgoing or incoming links
Reply #2 - Jul 15th, 2009 at 1:05pm
Print Post  
No. It is set to DrawLinks.
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Cannot create outgoing or incoming links
Reply #3 - Jul 15th, 2009 at 1:14pm
Print Post  
That was not the problem. I chagned the Behavior to Link tables and I was still not able to create links from any of the programmatically created nodes.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cannot create outgoing or incoming links
Reply #4 - Jul 15th, 2009 at 1:18pm
Print Post  
Are you handling InitializeNode or NodeCreated? What kind of properties are you setting there?
« Last Edit: Jul 15th, 2009 at 2:47pm by Stoyo »  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Cannot create outgoing or incoming links
Reply #5 - Jul 15th, 2009 at 1:54pm
Print Post  
No I am not handling either of those events.

This is all I am setting on the new node:
Code
Select All
newNode.Style = TableStyle.RoundedRectangle;
		newNode.CellFrameStyle = CellFrameStyle.None;
		newNode.CellCustomDraw = CustomDraw.None;
		newNode.AllowDrop = true;
		newNode.AllowIncomingLinks = true;
		newNode.AllowOutgoingLinks = true;
		newNode.AnchorPattern = kbaAnchorPattern;
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cannot create outgoing or incoming links
Reply #6 - Jul 15th, 2009 at 2:49pm
Print Post  
Could you copy your Diagram initialization code here?
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Cannot create outgoing or incoming links
Reply #7 - Jul 15th, 2009 at 3:37pm
Print Post  
Code
Select All
Diagram d = new Diagram();
		d.NodeActivated += new NodeEventHandler(diagram_NodeActivated);
		d.NodeDeactivated += new NodeEventHandler(diagram_NodeDeactivated);
		d.NodeDeleting += new NodeValidationEventHandler(diagram_NodeDeleting);
		d.NodeClicked += new NodeEventHandler(diagram_NodeClicked);
		d.NodeDoubleClicked += new NodeEventHandler(diagram_NodeDoubleClicked);
		d.LinkCreated += new LinkEventHandler(diagram_LinkCreated);
		d.LinkDeleting += new LinkValidationEventHandler(diagram_LinkDeleting);
		d.LinkClicked += new LinkEventHandler(diagram_LinkClicked);
		d.LinkDeselected += new LinkEventHandler(diagram_LinkDeselected);
		d.DragOver += new DragEventHandler(diagram_DragOver);
		d.Drop += new DragEventHandler(diagram_Drop);
		d.LinkHeadShape = ArrowHead.Triangle;
		d.Bounds = new Rect(0, 0, diagramWidth, diagramHeight);
		d.ShowGrid = true;
		d.GridSizeX = 15;
		d.GridSizeY = 15;
		d.AlignToGrid = true;
		d.ShowAnchors = ShowAnchors.Auto;
		d.AllowDrop = true;
		d.AllowUnanchoredLinks = false;
		d.AllowUnconnectedLinks = false;
		d.Behavior = Behavior.DrawLinks;
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cannot create outgoing or incoming links
Reply #8 - Jul 15th, 2009 at 4:00pm
Print Post  
It might not work because of the d.AllowUnanchoredLinks = false assignment, if the tables do not have any anchor points defined for them. If the tables' ConnectionStyle is set to Rows, you will have to set the AnchorPattern property of rows rather than the table's one.
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Cannot create outgoing or incoming links
Reply #9 - Jul 16th, 2009 at 3:20pm
Print Post  
Thanks for the help so far.

I changed the 'AllowUnanchoredLinks' to 'true' and I can place ancors.
However, now they do not move with the tableNode when I move the node. Also, they do not attach themselves to the anchor points that I specified.

While debuggin, I see that the 8 anchor points I added are there. I compared it during debug to a table node I dragged and dropped onto the diagram and the anchor points are the same.

The connection style is set to 'both'. This setting works on both the good nodes (the ones I drag onto the diagram) and the bad ones (the programmatically crated ones that don't allow me to add links).

Any suggestions?
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Cannot create outgoing or incoming links
Reply #10 - Jul 17th, 2009 at 6:21am
Print Post  
Hey,
I double checked again and indeed the ConnectionStyle was set to Rows, when it should have been set to Both. I thought I checked this before, but I guess my eyes were closed.

Now I know what the ConnectionStyle is for. Smiley

Thanks!
Darren
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint