Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Grouping of items (Read 9697 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Grouping of items
Apr 6th, 2009 at 8:41am
Print Post  
Hi,

I want to group some of the items and in place of them i want to display a single item.Can anybody help me in this ?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #1 - Apr 6th, 2009 at 9:31am
Print Post  
You could add the single item, call AttachTo(singleItem) for the other items in the group, and set them Visible = false. When you shoe them again, they should have preserved their position relative to the group item even if the user has moved it.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #2 - Apr 6th, 2009 at 10:11am
Print Post  
Hi Stoyan,

i have create an instance of group like this.

Group nodeGroup = new Group(diagram);

now plz tell me how to attachItems in this group.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #3 - Apr 6th, 2009 at 10:46am
Print Post  
Hi,

I have created a ContainerNode that groups the selected nodes and display them in a container window.
I want to do the same but I dont want that window.any body has any idea about this or can anybody tell me how can i make custom ContainerNode?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #4 - Apr 6th, 2009 at 12:49pm
Print Post  
You could create a groupNode of type ShapeNode, then call node.AttachTo(groupNode) for all nodes you need in the group; this automatically creates a Group instance. Enable groupNode.Transparent if you don't want that node to be Visible. If using a ContainerNode, you could set its Brush to a SolidColorBrush whose Color is set to Transparent.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #5 - Apr 8th, 2009 at 7:19am
Print Post  
Hi Stoyan,
I have created a groupNode of type ShapeNode.It creates a seprate node (when I click on a button)  but does'nt remove the existing nodes.When I Click on that group node and drag it at some another place, it replaces those selected nodes.I want the same operation but only when I click on the button.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #6 - Apr 8th, 2009 at 7:55am
Print Post  
You want the whole group to move when the button is clicked, but only the group node when dragging it interactively?
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #7 - Apr 8th, 2009 at 7:59am
Print Post  
I want,when I click on the button,all the selected nodes will represented by only a single groupNode instead of all the selected node and 1 extra combined node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #8 - Apr 8th, 2009 at 10:42am
Print Post  
More likely is does not replace them, but is simply drawn over them when the grouped nodes are no longer selected, while initially it is drawn behind them because of the SelectionOnTop property. Better for each node set Visible = false after calling AttachTo.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #9 - Apr 11th, 2009 at 12:15pm
Print Post  
Hi Stoyan,

Thanks for reply,
I have created a ShapeNode which is now working as a groupnode of some selected nodes.I have set its brush to tranparent.Now I want to see all its containing nodes inside this groupnode.
Is it possible, if yes how?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #10 - Apr 12th, 2009 at 11:20am
Print Post  
Use the Rect.Union method to find the rectangle that bounds all child nodes:

Code
Select All
private void CreateGroup(DiagramNode node, DiagramNodeCollection children)
{
	Rect r = Rect.Empty;
	foreach (DiagramNode child in children)
	{
		Rect cb = child.Bounds;
		r = r.IsEmpty ? cb : Rect.Union(r, cb);
	}
	double margin = 5;
	r.Inflate(margin, margin);
	node.Bounds = r;
	foreach (DiagramNode child in children)
		child.AttachTo(node, AttachToNode.TopLeft);
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #11 - Apr 12th, 2009 at 3:28pm
Print Post  
Hi Stoyan,

Thanks for the reply  Cheesy.90% problem is now solved. The only problem remaining is that still i am not able to see the child nodes in that group node.

I want to see all the child nodes inside that new groupnode,for that I have made groupnode transparent but not able to see its child nodes inside it.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #12 - Apr 13th, 2009 at 9:00am
Print Post  
Try calling the ZTop method for the child nodes, though if the group's Brush is transparent, you should see them even if they are at the back of Z order (as long as there aren't any other nodes between them and the group node).

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Grouping of items
Reply #13 - Apr 13th, 2009 at 12:53pm
Print Post  
No, its not working.
1. Anymore suggestion for the same.
2. Can u plz tell me how can i display more than one images in a single node simultanously ?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Grouping of items
Reply #14 - Apr 13th, 2009 at 4:38pm
Print Post  
Please e-mail a test project that shows what's not working to support@mindfusion.eu. You can display more than one image by either using custom-drawing, or by attaching additional ShapeNodes to display the additional images.

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