Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Attaching objects to links (Read 1750 times)
gfr
YaBB Newbies
*
Offline



Posts: 3
Joined: Dec 1st, 2008
Attaching objects to links
Dec 1st, 2008 at 10:53pm
Print Post  
Hi,

I was looking at the FCDemo.NET example.  The "Miscellaneous features - Grouping" example has objects attached to the link / arrow segments.  It was not obvious to me how to implement that.  Ideally I would like to add more than one object to an arrow segment, such that the objects would shift automatically if the arrow segments shifted.

Where can I find a good code example to implement that?

Thanks!
Greg
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attaching objects to links
Reply #1 - Dec 2nd, 2008 at 6:23am
Print Post  
Hi Greg,

You could call the AttachTo method of DiagramNode, e.g. this code attaches a node to the second segment of a link:

node.AttachTo(link, AttachToLink.Segment, 1);

This won't move automatically the node near the link. Use the DiagramNode.Move method to do that before calling AttachTo.

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



Posts: 3
Joined: Dec 1st, 2008
Re: Attaching objects to links
Reply #2 - Dec 2nd, 2008 at 7:08pm
Print Post  
Thanks!

I am using a LinkStyle = Bezier.  For some reason, when I move the link handles, the attached objects will move.  But, when I move the origin and destination shapes the attached objects don't move even though the link shape changes.  I basically want the attached objects to follow the link shape whenever it changes.  What am I missing?

Thanks again,
Greg
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attaching objects to links
Reply #3 - Dec 3rd, 2008 at 6:59am
Print Post  
The position of a node attached to a Bezier segment is relative to the middle of the line between the two intermediate control points in the segment. Moving the origin or destination changes the position only of the control points at the link ends, so it does not affect the attached nodes. We could add some property to the next release that would make the attachments follow the end points too.

Stoyan
  
Back to top
 
IP Logged
 
gfr
YaBB Newbies
*
Offline



Posts: 3
Joined: Dec 1st, 2008
Re: Attaching objects to links
Reply #4 - Dec 4th, 2008 at 10:34pm
Print Post  
Thanks.  That helps me understand what is going on.  I was expecting the objects to follow how the link line was drawn, not the control points.  Now I have a few options to try out.

Thanks again.

BR/Greg
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint