Page Index Toggle Pages: [1] 2 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) Usage of Group (Read 11861 times)
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Usage of Group
Jul 27th, 2010 at 8:00am
Print Post  
Hi,

I am trying to use Group class to group the nodes in workflow. Finding issue with the arrows being redrawn after adding the Group node.

I have a workflow with 2 nodes already connected and i am adding a group to the workflow grouping the two nodes already connected, after resizing the group box the connection between the 2 nodes is lost and it is redrawn over the group box.

Can you provide me a sample to use Group class for the scenario mentioned above, also I need to know how to capture the nodes once after the group is added to the workflow. There may be some events that needs implemented to capture the nodes that are made part of the Group, I feel i am missing something somewhere.

Thanks in advance
Velidanda
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #1 - Jul 27th, 2010 at 9:06am
Print Post  
Hi, What do you mean by "capture the nodes"?

Are you doing something like this?

Code
Select All
ShapeNode groupBox = diagram.Factory.CreateShapeNode(0, 0, 120, 40);
ShapeNode node1 = diagram.Factory.CreateShapeNode(10, 10, 20, 20);
ShapeNode node2 = diagram.Factory.CreateShapeNode(80, 10, 20, 20);
diagram.Factory.CreateDiagramLink(node1, node2);
node1.AttachTo(groupBox, AttachToNode.TopLeft);
node2.AttachTo(groupBox, AttachToNode.TopLeft); 

  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #2 - Jul 27th, 2010 at 9:30am
Print Post  
What I mean by capturing nodes is to get the nodes attached to the Group box and nodes should be moved when group box is moved.

Is Group class meant to be used for that?

I have the shape nodes already added to the workflow and I want to add a group box onto the flow and attache the nodes to the group. When I move the group box I need to get the nodes moved along with the group box.

Is this possible using Group class or I need to use some other classes?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #3 - Jul 27th, 2010 at 10:02am
Print Post  
Yes, it's possible. The AttachTo methods shown above create a Group object internally.

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


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #4 - Jul 27th, 2010 at 10:15am
Print Post  
Hi,

Thanks for you reply,

I need some sample that gets the nodes from the UI within the bounds of the group box and then to attach them to the group while resizing or moving the group box.

Please let me know if any sample application available for this.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #5 - Jul 27th, 2010 at 10:23am
Print Post  
Hi,

It should look like this:

Code
Select All
private void diagram_NodeCreated(object sender, NodeEventArgs e)
{
	if (...) // if this is a group box
	{
		foreach (DiagramNode n in diagram.Nodes)
		{
			if (e.Node.Bounds.Contains(n.Bounds))
				n.AttachTo(e.Node, AttachToNode.TopLeft);
		}
	}
} 



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


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #6 - Jul 28th, 2010 at 6:27am
Print Post  
Hi Stoyan,

I was trying to see as when the diagram_NodeCreated() event fires but in our case the event is never fired and I could not get the nodes attached to the Group.

We were using older version of MindFusion Flowchart control and currently trying to use the latest MindFusion.Diagramming control.

Could you let me know if there would be any design changes compared to Older Flowchart control and latest MindFusion.Diagramming control version 5.3?

Thanks & Regards
Velidanda
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #7 - Jul 28th, 2010 at 7:15am
Print Post  
Hi Velidanda,

Have you attached this method to the Diagram.NodeCreated event? When you select the Diagram object in the form, open the Events tab in the property window and choose the method in the NodeCreated drop-down. If you are creating diagrams from code, use the C# += operator or VB.NET AddHandler method.

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


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #8 - Jul 28th, 2010 at 7:52am
Print Post  
Yes, the method is attached that I can see in the code by using += in C# code.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #9 - Jul 28th, 2010 at 7:55am
Print Post  
The event fires only when you draw nodes interactively. Are you adding the group node by code?
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #10 - Jul 28th, 2010 at 8:57am
Print Post  
Yes, it is being added from code.

We have code to add group when I drag and drop group element that is a made available in toolbox.

What exactly you mean by 'adding interactively'.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #11 - Jul 28th, 2010 at 9:06am
Print Post  
I mean if you draw nodes with the mouse. In case you add them from code, you could call Diagram.RaiseCreated so that the event is raised. That will let you setup nodes drawn with the mouse and created from code using the same handler.

If your nodes are always created using drag-and-drop, you can move the code from the method above to your Drop handler and do not bother with NodeCreated.

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


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #12 - Jul 28th, 2010 at 12:32pm
Print Post  
I am able to fire the event but still finding problem attaching the nodes, I cannot move the nodes attached when I move the group box on the UI.

I have a class named DiagramGroup extending MindFusion.Diagramming.DiagramNode and within that I have a MindFusion.Diagramming.Group property and I am adding a Shapenode as MainItem for the group.

Now when I raise the NodeCreated event I can only send the DiagramGroup class as parameter as Diagram.RaiseCreated() takes parameter of type DiagramNode and while running thru the code I see the nodes are getting attached those are within the bounds of Group box but after the method to attach the nodes is executed the nodes on UI doesn't seem moving when I move Group box.

Can you let me know what shall be done in this case to actually attach the nodes to Group?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Usage of Group
Reply #13 - Jul 28th, 2010 at 12:41pm
Print Post  
Are you attaching child nodes to that DiagramGroup node via the AttachTo method, or attaching them to the Group property of the DiagramGroup node?

In the latter case, the child nodes would follow the MainItem of the Group object, and not the DiagramGroup node. And from what I can understand, you are setting DiagramGroup.Group.MainItem to a different node than DiagramGroup...

If you just call childNode.AttachTo(DiagramGroup), that will automatically create a Group instance accessible through the DiagramGroup.SubordinateGroup property, and then childNode will follow DiagramGroup.

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


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Usage of Group
Reply #14 - Jul 28th, 2010 at 12:48pm
Print Post  
I got it working to see the nodes attached to the ShapeNode object which is assigned as the MainItem of Group object of DiagramGroup class.

here is the code, not sure exactly what's happening but now I can move the nodes those are attached, Can you let me know what I am doing is correct?

I am calling below NodeCreated() passing ShapeNode object that is set as MainItem of the Group object of DiagramGroup class.

void fcMap_NodeCreated(object sender, NodeEventArgs e)
{
if(e.Node is ShapeNode)


foreach(MindFusion.Diagramming.DiagramNode n in this.fcMap.Nodes)


{



if (e.Node.Bounds.Contains(n.Bounds))




n.AttachTo(e.Node, AttachToNode.TopLeft);


}
}
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send TopicPrint