Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Allow Unconnected Arrows -  Some of the time (Read 2616 times)
mattapayne
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Mar 6th, 2007
Allow Unconnected Arrows -  Some of the time
Mar 26th, 2007 at 3:48pm
Print Post  
Hi Again,

Another question for you:

In the current scenario that I'm working on, I need to allow the user to draw an arrow from a node (Box) to either a node (Box) or to another arrow. If they draw to another arrow, I programmatically create a new node, split the destination arrow and insert the new node between the newly created arrows. These are the only cases in which I want arrows to be created.

To support drawing an arrow to an arrow, I think I have to set AllowUnconnectedArrow to true, otherwise I can only connect arrows between nodes. Is this correct?

While providing this functionality, I also need to allow the user to select many items on the diagram (via the left mouse button/drag).

The problem that arises is that if I set AllowUnconnectedArrows to true I can no longer support the left mouse button/drag to select element, because instead an arrow is drawn.

So far the only solution I can find is to set AllowUnconnectedArrows to true when a node's activated event fires and to set AllowUnconnectedArrows to false when a node's deactivated event fires.

While this does work, it's a little clunky. I can create an arrow from a node without activating the node. In this case, the user could not connect the arrow to another arrow because AllowUnconnectedArrows would never have been set to true.

Have you got any suggestions as to how I could make this work a little better?

Thanks,
Matt


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allow Unconnected Arrows -  Some of the time
Reply #1 - Mar 26th, 2007 at 4:30pm
Print Post  
Hi,

You could keep AllowUnconnectedArrows enabled all the time, and create a custom Behavior class that inherits FlowChartBehavior. From the overridden StartDraw method return new InteractionState(FlowChart.Selection, -1, Action.Create) if there isn't any node under the mouse pointer, otherwise return base.StartDraw().

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


I love YaBB 1G - SP1!

Posts: 15
Joined: Mar 6th, 2007
Re: Allow Unconnected Arrows -  Some of the time
Reply #2 - Mar 26th, 2007 at 4:47pm
Print Post  
Helpful, as always. Thanks, Stoyo.

Matt
  
Back to top
 
IP Logged
 
mattapayne
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Mar 6th, 2007
Re: Allow Unconnected Arrows -  Some of the time
Reply #3 - Mar 26th, 2007 at 5:40pm
Print Post  
Hi Stoyo,

FlowChartBehavior looks to be an internal sealed class.

I'm using v4.0.3 - Sorry, should have mentioned that before.

I'd rather not customize the library.

Any other suggestions?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allow Unconnected Arrows -  Some of the time
Reply #4 - Mar 27th, 2007 at 4:27am
Print Post  
Hi Matt,

It is a public class in version 4.3, which you should have received as an upgrade a few weeks ago.

If you prefer to stay with version 4.0.3, you can still inherit from the base Behavior class. However, you would need to copy some part of the FlowChartBehavior code to reproduce the standard drawing logic.

Another option is to handle the MouseMove event and check whether the mouse is over a node. If the mouse button is not pressed and there isn't a node under the mouse pointer, set AllowUnconnectedArrows to false, so that users can draw arrows only from nodes. In all other cases, set AllowUnconnectedArrows = true.

Stoyan
  
Back to top
 
IP Logged
 
mattapayne
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Mar 6th, 2007
Re: Allow Unconnected Arrows -  Some of the time
Reply #5 - Mar 27th, 2007 at 11:45am
Print Post  
Hi Stoyo,

Unfortunately, I'm not able to upgrade at this moment.

I do have the source code, but it appears that most of the functionality that I would need to reproduce FlowChartBehavior is also internal to the assembly. (ie various methods, etc.)

Maybe I'll have a look at your second suggestion.

Thanks again.

Matt
  
Back to top
 
IP Logged
 
mattapayne
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Mar 6th, 2007
Re: Allow Unconnected Arrows -  Some of the time
Reply #6 - Mar 27th, 2007 at 12:07pm
Print Post  
Hi Stoyo,

The MoveMove handler suggestion works great!

Thanks again.

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