Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How can I disable on-diagram editing? (Read 1221 times)
WTW
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: May 20th, 2009
How can I disable on-diagram editing?
May 20th, 2009 at 6:57pm
Print Post  
Hello,

I am currently evaluating MindFusion.Diagram for a very simple application.  I want to allow a user to create a simple diagram of steps in an assembly process.  I have created a test program that allows adding and deleting steps using ShapeNodes and DiagramLinks.  The user can add a new step by selecting a step on the diagram, and then pressing an "Add before" or "Add after" button.  The user can delete a step by selecting it on the diagram and then pressing "Delete".

My difficulty at this point is that I do not want the user to be able to edit the diagram directly.  I want him to be able to select a step and then do add/delete using buttons which will do these things programmatically.

I want the user to be able only to select a ShapeNode on the diagram.  I do not want him to be able to select the DiagramLinks.

1.) How can I create a diagram that disables all direct modification of the diagram, and enables only node selection?

2.) How can I ensure that a least one ShapeNode is selected at all times?

I have tried various combinations of Diagram.ShapeHandlesStyle, Diagram.LinkHandlesStyle and DiagramView.Behavior, but I can't seem to find the right combination.

Thanks for your help with this.

WTW


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I disable on-diagram editing?
Reply #1 - May 21st, 2009 at 4:51am
Print Post  
Hi,

1) One way to do that is to enable the Modify behavior to disable creation of new items. To disable modification, call e.CancelDrag() from the NodeModifying event handler. To disable link selection, set their Locked property, or set e.Cancel from the LinkSelecting validation event handler.

2) Try checking if Selection.Items.Count is 0 in the SelectionChanged handler. If so, select programmatically the last selected node.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint