Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Arrow segments doubt (Read 4564 times)
Carlos_Rocha
Junior Member
**
Offline


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
Arrow segments doubt
Jun 30th, 2011 at 11:32pm
Print Post  
Hi,

I'm trying to create links with 3 segments in a way that both start and end segments are horizontal with a small pre-defined lenght, and a non perpendicular middle segment with variable size.

Along with this I want the arrows always anchored to the left or right sides of the linked nodes by using the smaller distance. Is there a (more or less) simple way to get this behaviour?



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow segments doubt
Reply #1 - Jul 1st, 2011 at 6:18am
Print Post  
Hi,

Call this method after creating links from code, or in response to events such as ArrowCreated and BoxModified -

Code
Select All
Sub SetArrowShape(a As arrow)
	a.Dynamic = True
	a.Style = asPolyline
	a.Segments = 3
	a.CtrlPtY(1) = a.CtrlPtY(0)
	a.CtrlPtY(2) = a.CtrlPtY(3)
	If a.CtrlPtX(0) < a.CtrlPtX(3) Then
		a.CtrlPtX(1) = a.CtrlPtX(0) + 15
		a.CtrlPtX(2) = a.CtrlPtX(3) - 15
	Else
		a.CtrlPtX(1) = a.CtrlPtX(0) - 15
		a.CtrlPtX(2) = a.CtrlPtX(3) + 15
	End If
	a.Update
End Sub 



It assumes the arrow connects only to the left or right sides, e.g. by using table nodes or anchor points.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Carlos_Rocha
Junior Member
**
Offline


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
Re: Arrow segments doubt
Reply #2 - Jul 1st, 2011 at 6:58am
Print Post  
Thanks, it helps, but it's not working in my scenario, maybe because it's a bit different:

I allow unconnected arrows. When the arrow is created I'm doing exactly what you are suggesting (thought only inside the event ArrowCreated, for now), and after that I create a new table and make arrow.Destination = TheNewTable.

Also, my tables are a group of Box+Table, where the Box represents the table header, and I'm trying to link both boxes (table headers). I didn't define anchor points in boxes, could it be the reason?

I'm also trying to make this while defining the arrow, inside the event RequestCreateArrow, but the arrow is always a straight line.

EDIT: it works when linking rows, and I was wrong about RequestCreateArrow - it crashes when trying so I gave up from it. Is there another way to make it while drawing the arrow?

EDIT1: it works with boxes too after defining a AnchorPattern.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow segments doubt
Reply #3 - Jul 2nd, 2011 at 11:35am
Print Post  
You won't be able to set the points while creating an arrow at this time.

It seems the crash happens when calling Update from the Request handler because it expects that the link's Destination is already set. You can work around that by checking for destination in SetArrowShape:
If Not a.Destination Is Nothing Then a.Update.

However that's of no use, since the control puts all points on a straight line again immediately after you modify them from the request handler.
  
Back to top
 
IP Logged
 
Carlos_Rocha
Junior Member
**
Offline


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
Re: Arrow segments doubt
Reply #4 - Jul 2nd, 2011 at 10:41pm
Print Post  
I also tried inside RequestCreateArrow (snipet):

if a.destination = nothing
Create Box
Set the destination to Box
Group = CreateGroup(a)
Group.AttachToArrowPoint(Box,3)
else
Call SetArrowShape(a)
endif

The calling to update() inside SetArrowShape doesn't crash anymore, but the arrow is still a straight, and even if the box moves along with ControlPoint(3) the screen is not refreshed and the original box image stays in place until the call to ArrowCreated.
It seems the control ignores all events but MouseMove while RequestCreateArrow is called, what makes sense.

So, i guess there's no chance to get this behavior, right?

EDIT: I just noticed that with asPerpendicular the arrow is updated inside RequestCreateArrow, so what's missing is asTableLink in EArrowStyle  Grin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow segments doubt
Reply #5 - Jul 3rd, 2011 at 7:57am
Print Post  
RequestCreate is a validation event and the control expects the handler will only return a bool value. It is raised before setting the default link control points for the current mouse position, so setting custom points there will have no effect.

We could add some kind of route-arrow event to let you set the shape of polyline links, or implement a new EArrowStyle indeed. If you have active support, contact us by email and our developer can implement that next week.

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


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
Re: Arrow segments doubt
Reply #6 - Jul 3rd, 2011 at 7:09pm
Print Post  
Quote:
If you have active support, contact us by email and our developer can implement that next week.


IMO, the ideal would be a new EArrowStyle, and I will certainly ask for this feature After buying FC (which will be as soon as po$$ible).

Thank you for your attention.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint