Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic A question about Self-loop link (Read 2881 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
A question about Self-loop link
Aug 17th, 2011 at 7:07am
Print Post  
hi Stoyo:

I already read the thread here:
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=130734859...
and get help from it. But it is not enough.

User can use mouse to change a self-loop link and also can redo/undo. So I have to change self-loop
programmatically. I can set Link.Style to PolyLine, Link.SegmentCount to 3 and modify self-loop
link successfully. But it cause other problem, such as choose a node that has a self-loop link and
move it, the self-loop link can not be moved with same outline. If I do not change the self-loop link
and move the node first then the self-loop link can be moved perfectly.

By the way in the thread above you said a self-loop link must have 3 segments. But MindFusion.Diagramming.dll can create a self-loop link that only has 1 segment and the style is PolyLine. I do believe this is default behavior. Maybe there are some private or protected methods finish that work.

Could you give some helps to solve this problem completely ? Thanks a lot
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: A question about Self-loop link
Reply #1 - Aug 17th, 2011 at 7:28am
Print Post  
Hi,

If you need to prevent the user from modifying a self-loop link, you could set its Locked property, or cancel modifications from the LinkModifying event.

I have tried this with several types of self-loop links in the demo, but the links always follow their node as expected when moved - by translating all points by the same offset. Have you enabled some other properties for the link, such as AutoRoute or Dynamic?

Stoyan
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: A question about Self-loop link
Reply #2 - Aug 17th, 2011 at 11:15pm
Print Post  
hi Stoyan:
I got progress. But found a new problem. I draw a self-loop link and change it by mouse so the link has 4 or more segments. Then change the location of first point when first time to do that I drag the first point, all points else of the link will follow the first point to move. I think because I set property LinksRetainForm of Diagram to true.

Then second time to change the location of first point, when I drag the first point all points else do not follow the first node to move. I set RetainForm property to true but it does not work.

How to solve this problem ???
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: A question about Self-loop link
Reply #3 - Aug 18th, 2011 at 5:22am
Print Post  
Hi,

I cannot reproduce that. Are you sure you are not setting the link points from some event handler?

Stoyan
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: A question about Self-loop link
Reply #4 - Aug 19th, 2011 at 2:30am
Print Post  
Explain more about what I did. I change the location of first point twice. Every time I just change the location of the first point that means the destination node and origin node of link still are same, self-loop link still is a self-loop link. I set property AutoRoute, Dynamic to default value. First time to change first point location all points else of link can follow first point to move but second time these points can not.

When I drop the first point, event LinkModified will be lauched. In the event I write below code to change self-loop link.

// Actually link.Destination and DestinationShape is same node
link.Destination = DestinationShape;

// Actually link.Origin and OriginShape is same node
link.Origin = OriginShape;
link.RetainForm = true;

// this code can solve the problem that I post at very beginning.
if (object.ReferenceEquals(DestinationShape, OriginShape) == true)
{
link.SegmentCount = 5;
link.Style = MindFusion.Diagramming.LinkStyle.Polyline;
}

// before execute this line code, at other place points already be saved to a local variable
// named Backup_ControlPoints.
link.ControlPoints.Clear();

// here add points to link again so points are same, not be changed.
link.ControlPoints.AddRange(Backup_ControlPoints);
link.UpdateFromPoints();

Of course above code is a sample, To clear and add same points is not meaning. But if this code can work I will use it to do something in same way.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: A question about Self-loop link
Reply #5 - Aug 19th, 2011 at 8:37am
Print Post  
Could you email to support@mindfusion.eu a test project that shows how all points move when dragging the first point?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint