Here is the scenario: User selects a tree node in the treeview control, and then drags it over top of the flowChart control. When dragging over the FlowChart control, the drag cursor looks like a textbox. After the drop, a text box will appear in the FlowChart control.
A: You can do that by calling Control.DoDragDrop from the TreeView.MouseDown event handler, and creating the node in the DiagramView.DragDrop event. See the ListView in the Flowcharter sample project, and in one of the "miscellaneous" steps of the FCDemo example.
A: There is a Diagram.NodeTextEditing validation event raised when the user double-clicks a node. Set e.Cancel to true to prevent editing the text of some nodes.
Q: I have set the Behavior property of the DiagramView object to DrawLinks, but when I drag from Node to Node, I only select the two Nodes: no link is drawn. What settings should I check that could influence this behavior?
A: Check Diagram.AllowUnanchoredLinks and DiagramNode.AllowOutgoingLinks. If you have disabled the former, you can draw links only from nodes whose AnchorPattern is set.
Q: I am generating diagrams with node images, and would like the user to be able to start moving nodes with a single click. In addition, the users should not be able to create new items, not resize existing ones. Should I create a custom Behavior object for this?
A: This can be implemented by setting a few properties:
- set DiagramView.Behavior to Modify
- set the HandlesStyle of nodes to MoveOnly
- set ModificationStart to AutoHandles
- return new InteractionState(currentItem, 8, Action.Modify);
- return new InteractionState(fc.Selection, -1, Action.Create);
- return new InteractionState(fc.Selection, 8, Action.Modify);
Q: I am looking for the simplest method to dynamically change the link anchor points on a node so that anchor is nearest to the connecting node. I don't want the links to cross over the source node if the destination node position changes.
A: Check how links work when their Dynamic property is enabled. It will make the links change their origin and destination connection points while dragging a node around.