Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Issue with createing shapenode in second container (Read 1032 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Issue with createing shapenode in second container
Mar 9th, 2010 at 8:16am
Print Post  
Hi Stoyo

With following code, allows me select container item, which is added in another container ....

ContainerNode container = new ContainerNode(this.diagram);
container.Bounds = new Rect(0, 0, 500, 500);
this.diagram.Nodes.Add(container);

ShapeNode shape1 = new ShapeNode(this.diagram);
shape1.Bounds = new Rect(0, 0, 50, 50);
shape1.Constraints.KeepInsideParent = true;
container.Children.Add(shape1);
this.diagram.Nodes.Add(shape1);

ContainerNode container2 = new ContainerNode(this.diagram);
container2.Bounds = new Rect(0, 0, 200, 200);
container2.Constraints.KeepInsideParent = true;
container.Children.Add(container2);
this.diagram.Nodes.Add(container2);

Now, if I add following new shape in "container2" doesn't allow me to select container2. It gets placed below container1. [ Container 1 and container2 gets same Z-Index i.e "0".

shape1 = new ShapeNode(this.diagram);
shape1.Bounds = new Rect(25, 25, 50, 50);
shape1.Constraints.KeepInsideParent = true;
container2.Children.Add(shape1);
this.diagram.Nodes.Add(shape1);

Will you help me in fixing this issue.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Issue with createing shapenode in second conta
Reply #1 - Mar 9th, 2010 at 11:14am
Print Post  
This works:

Code
Select All
shape1 = new ShapeNode(this.diagram);
shape1.Bounds = new Rect(25, 25, 50, 50);
shape1.Constraints.KeepInsideParent = true;
this.diagram.Nodes.Add(shape1);
container2.Children.Add(shape1); 



The container's ZIndex is automatically set to a lower value than the one of the added item. However the item's index is considered 0 before adding it to diagram.Items, so you must only exchange the positions of the container.Children.Add and diagram.Nodes.Add calls.

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