Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Origin and Destination (Read 2845 times)
Ganesh Muthuvelu
Guest


Origin and Destination
Feb 13th, 2006 at 8:21pm
Print Post  
Hello,
I have two tree layout controls in a Flow chart control and I am drwaing arrows from one node of the tree to the other node of the tree. I need to know how would I enforce the chart control that the arrow cannot have the origin and destination - the same tree?. Is there a property setting for this?.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Origin and Destination
Reply #1 - Feb 13th, 2006 at 9:14pm
Print Post  
Hi,

Do you mean you have two TreeView controls hosted in ControlHost nodes, or boxes arranged in two distinct trees in the same diagram ? If the former, just set AllowReflexiveLinks to false. If using boxes, handle the ArrowCreating event and set args.Confirm = false if the boxes being linked are in the same tree.

Stoyan
  
Back to top
 
IP Logged
 
Ganesh Muthuvelu
Guest


Re: Origin and Destination
Reply #2 - Feb 14th, 2006 at 7:05pm
Print Post  
Hi,
I am new to FlowChart .NET. Sorry if I sound silly - but how would I check if the arrow is linked to the same tree?. Could you post some sample code for me?.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Origin and Destination
Reply #3 - Feb 14th, 2006 at 7:52pm
Print Post  
Hi,

I guess you would have to identify to which tree a box belongs, that could be done by setting the box.Tag. E.g. if all boxes in one tree have 0 assigned as a Tag and all boxes in the other tree have 1 assigned as a Tag, you could handle ArrowCreating like this:

private void fc_ArrowCreating(object sender, MindFusion.FlowChartX.AttachConfirmArgs e)
{
  int originTree = (int)e.Origin.Tag;
  int destTree = (int)e.Destination.Tag;
  if (originTree == destTree)
    e.Confirm = false;
}

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Ganesh Muthuvelu
Guest


Re: Origin and Destination
Reply #4 - Feb 14th, 2006 at 8:02pm
Print Post  
Hi Stoyan,
Thanks for the quick reply. I have some problems in your approach:
1) I need a unique "tag" for each box, since I am using that tag value for some other purposes. So, I cannot have the same tag for every box in one tree. Can you propose me some other way?.

2) Also, I see that Box, Arrow - all have a Tag property which I can use it to store some application specific value. In my case, I need to store more than one value for each Box or arrow. I could use a collection object for this - but I do not want to use collection objects. Instead, I am thinking of inherting the Box and Arrow classes and add my own properties to it. Do you think this approach is the right way to go about?.  If yes, could you post some sample inherited classes of box/arrow?.

Please share your views.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Origin and Destination
Reply #5 - Feb 15th, 2006 at 5:39am
Print Post  
Hi Ganesh,

You can create a class containing several fields and assign its instances to box Tags. E.g.

[Serializable]
class BoxProperties
{
  int id;
  int tree;
}

box.Tag = new BoxProperties();
...

Inheriting the Box class would require overriding several serialization methods and inheriting the FlowChart class too, so using Tags is much easier.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint