Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Outgoing/Incomming arrows (Read 3836 times)
MagnusSpeychal
Junior Member
**
Offline



Posts: 53
Joined: Jun 18th, 2007
Outgoing/Incomming arrows
Jul 3rd, 2007 at 6:41am
Print Post  
Hi

I have created an arrow between two boxes using the "CreateAnchoredArrow" method. I have learnt from the Developers guide that using this method overrides the anchor point type (intended for outgoing/incomming arrows). Does this mean that the "GetOutgoingArrows" and "GetIncommingArrows" methods are affected aswell because both methods return zero (0) despite having several arrows connected to the actual box.


Best regards,
Magnus
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Outgoing/Incomming arrows
Reply #1 - Jul 3rd, 2007 at 8:38am
Print Post  
Hi,

IncomingArrows and OutgoingArrows return IArrows collections, whose Count property contains the number of arrows in the collection. Did you get 0 returned by the Count property?

Stoyan
  
Back to top
 
IP Logged
 
MagnusSpeychal
Junior Member
**
Offline



Posts: 53
Joined: Jun 18th, 2007
Re: Outgoing/Incomming arrows
Reply #2 - Jul 3rd, 2007 at 9:19am
Print Post  
Hi Stoyan

Yes. The "GetCount" method returned zero (0).
Here is some of my code:

BoxItem bd=box;
Arrows arr;

arr=bd.GetOutgoingArrows();
NumberOfArrows=(arr.GetCount());

After the code above NumberOfArrows is equal to zero.


Best regards,
Magnus
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Outgoing/Incomming arrows
Reply #3 - Jul 3rd, 2007 at 10:28am
Print Post  
Hi Magnus,

With this code I get correctly shown one arrow in the b1.OutgoingArrows and one in b2.IncomingArrows

Dim b1 As box
Dim b2 As box
Dim a As arrow
   
Set b1 = fc.CreateBox(0, 0, 40, 40)
b1.AnchorPattern = fc.AnchorPatterns("Decision2In2Out")
Set b2 = fc.CreateBox(90, 0, 40, 40)
b2.AnchorPattern = fc.AnchorPatterns("Decision2In2Out")
Set a = fc.CreateAnchoredArrow(b1, 1, b2, 3)
   
MsgBox b1.OutgoingArrows.Count
MsgBox b1.IncomingArrows.Count
MsgBox b2.OutgoingArrows.Count
MsgBox b2.IncomingArrows.Count

Are you sure you are checking correct collection (incoming or outgoing)?

Stoyan
  
Back to top
 
IP Logged
 
MagnusSpeychal
Junior Member
**
Offline



Posts: 53
Joined: Jun 18th, 2007
Re: Outgoing/Incomming arrows
Reply #4 - Jul 3rd, 2007 at 12:05pm
Print Post  
Hi Stoyan

I have tried both collections (outgoing and incomming).
Both return zero.
Is there some special syntax for the C++ language that I might have missed?


Best regards,
Magnus
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Outgoing/Incomming arrows
Reply #5 - Jul 3rd, 2007 at 12:52pm
Print Post  
Hi Magnus,

Here is a modified MFC Anchors example that does the same as the VB code above; it seems to work fine too.

https://www.mindfusion.org/_temp/Anchors.zip

Stoyan
  
Back to top
 
IP Logged
 
MagnusSpeychal
Junior Member
**
Offline



Posts: 53
Joined: Jun 18th, 2007
Re: Outgoing/Incomming arrows
Reply #6 - Jul 4th, 2007 at 10:13am
Print Post  
Hi Stoyan

Thank you for the example. I have tried it on my computer and it works just fine as you say. I have also changed it to resemble my original problem and it works fine then aswell.
I do not know why it does not work in my original project but I have managed to find a work-around.
One difference between my original problem and the example you sent is that I use my own defined anchor points. Can this have something to do with my problem?
I have also noted that with my own defined anchor points the arrows created with the "CreateAnchoredArrow" method sometimes attaches the arrow to the wrong achor point! Cry
When using the "CreateAnchoredArrow" method, what is the index of the first anchor point? 0 (zero) or one (1)?


Best regards,
Magnus
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Outgoing/Incomming arrows
Reply #7 - Jul 4th, 2007 at 11:24am
Print Post  
Hi Magnus,

The first index is 0, and the indices correspond to the order in which you call AddAnchorPoint. The control does not treat the predefined anchor patterns any differently than the custom ones. You might check whether using an index >= than the number of points would cause that problem.

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