Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic box creation restriction (Read 1984 times)
JDogggieIII
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Jan 31st, 2012
box creation restriction
Jan 31st, 2012 at 8:33pm
Print Post  
Hello,

I have a flowchart.net instance in my C# application.  At one point during the user workflow I would like them to be able to move arrows around, but not for them to be able to create new nodes.  I have spent a good amount of time trying to find a way to restrict the user from creating new boxes but have been unsuccessful.  Is there any way to do this while still allowing them to move arrows around?

Many thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: box creation restriction
Reply #1 - Feb 1st, 2012 at 8:11am
Print Post  
Hi,

You could call e.CancelDrag() from the NodeCreating handler. That should also be possible by setting EnabledHandles = None on all nodes, or setting DiagramView.Behavior to CreateLinks.

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


I Love MindFusion!

Posts: 3
Joined: Jan 31st, 2012
Re: box creation restriction
Reply #2 - Feb 2nd, 2012 at 2:52pm
Print Post  
Hi Stoyan,

Thanks for the info.  One further question since I am new to this FlowChart .Net scene...

I'm assuming I must override the handler in order to call e.CancelDrag() (or make any changes to it's behavior).  However, I am struggling with this.  I've overridden things before without issue, so perhaps it's my lack of sleep or broken brain  Cheesy.  Do you perhaps have any example code for this sort of thing?

Many thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: box creation restriction
Reply #3 - Feb 2nd, 2012 at 3:34pm
Print Post  
Hi,

If you have placed the Diagram object on a form, select it in the form designer, open the property window, switch to the event list and double-click NodeCreating to create an event handler.

If you create a Diagram from code, you could add a NodeCreating hanlder like this:

Code
Select All
diagram.NodeCreating += OnNodeCreating;

void OnNodeCreating(object sender, NodeValidationEventArgs e)
{
    e.CancelDrag();
} 



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


I Love MindFusion!

Posts: 3
Joined: Jan 31st, 2012
Re: box creation restriction
Reply #4 - Feb 4th, 2012 at 8:46pm
Print Post  
Hi Stoyen,

Thank you.  That was very helpful.  I am now able to achieve what i was trying to do.

Thanks again.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint