Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Several things regarding container nodes (Read 1951 times)
Bass
YaBB Newbies
*
Offline



Posts: 31
Joined: Aug 27th, 2010
Several things regarding container nodes
Jun 2nd, 2011 at 8:46am
Print Post  
Hi,

Today I started playing with container nodes, but I can't get it set up the way I intend to.

Some issues I am having:

1)
I call ContainerNode.Add(DiagramNode) to add a node to a container. The node is added, but I am not able to select it although I get the "hand" cursor when I hover over it.

2)
When the container loses focus, the nodes inside the container disappear. Even if I set the ZOrder of the nodes to equal the ContainerNode.ZOrder + 1.

3)
Is there a way to arrange the nodes inside the container in such a way a ListBox looks when set to ListBox.View = LargeIcon ? (i.e. in a grid-like arrangement). If not, how do I handle the positioning of the node inside the container node?

4)
Is it possible to add objects like a ListView or TreeView to a container node, or is this exclusive to the ControlNode? I kind of like the fold/unfold concept of the ControlNode from its header.

Thanks for your answers.

Kind regards,
Bas






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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Several things regarding container nodes
Reply #1 - Jun 2nd, 2011 at 9:36am
Print Post  
Hi,

1,2) Yes, that happens because of Z order. Setting the child's ZIndex to ContainerNode.ZIndex + 1 might not work if the container is already at the top of Z order, because the control allows only indices in the range 0.. items - 1. Try setting the container's index to 0 instead.

3) Use this code:

int nodesOnLayer = 5;
float cx = container.Bounds.X + container.Margin;
float cy = container.Bounds.Y + container.Margin;
for (int i = 0; i < container.SubordinateGroup.AttachedNodes.Count; ++i)
{
     diagram.Nodes[i].Move(
           cx + (i % nodesOnLayer) * 50,
           cy + (i / nodesOnLayer) * 50);
}
container.UpdateBounds();

4) You will have to add it to a ControlNode and then the ControlNode to a ContainerNode.

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



Posts: 31
Joined: Aug 27th, 2010
Re: Several things regarding container nodes
Reply #2 - Jun 2nd, 2011 at 10:08am
Print Post  
Thanks for the update.

I switched my test app to use a control node, and I am very close to the use case I want.

Can you perhaps tell me if it is possible to have some kind of a border when using control nodes?

I have such a node with a listview inside, but it feels a bit "thin" around the edges if you know what I mean  Wink

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Several things regarding container nodes
Reply #3 - Jun 2nd, 2011 at 10:21am
Print Post  
ControlNodes leave all painting to their hosted controls. If changing the ListView's BorderStyle does not work for you, you have a couple of options:
- override the Draw method of CotnrolNode to draw a border
- create a group of ShapeNode and ControlNode, and set the ShapeNode's properties to customize the border.

Also you might consider using TableNodes or TreeViewNodes instead if all you need is to display list data inside a node.

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