Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) ZLevel Ordering (Read 6163 times)
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
ZLevel Ordering
May 25th, 2010 at 8:23am
Print Post  
Hi.

I just started to work with Z-Leveling with ControlNodes.
I have two Nodes on my diagram, where one is Level 0 and the other is Level 1. When I just load this config it is like it shoulb be. But when I click one of these nodes (even it is the node on the bottom of the ordering) it is shown in front of the other nodes. this confuses a little bit. How can I configure the diagram this way, that the z-Level ordering isn't changed when I click on a node.

Another Question: When an object is behind another object and I want to move this, is it possible to show only the handles of this object? So the user has the possibility to move this object, even it is behind other nodes.

Thanks for help.

I allready tried "SelectionOnTop" but it is still not working. When I click on a node it is paint on the top. Sad
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZLevel Ordering
Reply #1 - May 25th, 2010 at 9:17am
Print Post  
Hi,

At this time a ControlNode always calls BringToFront on its hosted control when activated. You might try calling SendToBack in response to the NodeActivated event to bring it back again.

Also the diagram's Z order is not automatically synchronized with the Z order of the WinForms controls in the form. You can use a similar method to synchronize them after setting the ZIndex values in the diagram:

Code
Select All
private void SyncZOrder()
{
	foreach (DiagramItem item in diagram.Items)
	{
		ControlNode host = item as ControlNode;
		if (host != null)
			host.Control.BringToFront();
	}
} 



Unfortunately there's no way for the diagram to draw selection handles over a different control in the front. Perhaps we can implement it by drawing the handles in a new custom control (otherwise always transparent) that is in front of the DiagramView and all hosted controls, but it's not something we can do in the short term.

Stoyan
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #2 - May 25th, 2010 at 11:47am
Print Post  
Hi.

Thanks. That worked for me.
But there is another problem I recognized:
I create my ControlNode like this:

Code
Select All
ControlNode node = new ControlNode(diagram);
diagram.Nodes.Add(node);
node.ZIndex = (int)itemVO.ZLevel; 


I stored the ZLevel in my ItemVO. But when I step through these lines of code, node.ZIndex is still 0 after doing the last line. Why?

Can you help me with this?

Thanks again.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZLevel Ordering
Reply #3 - May 25th, 2010 at 11:55am
Print Post  
ZIndex corresponds to the item's position in diagram.Items, and you can't set it to a value larger than the number of items. So if itemVO.ZLevel is >= Items.Count, the setter will ignore this assignment.

Stoyan
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #4 - May 25th, 2010 at 12:11pm
Print Post  
Ah OK. I managed this task by assigning my safed zlevel after creating all objects. But the diagram do not show this actualized configuration. it has still the ordering from the beginning. is there something like redraw, update or refresh for the diagram or diagramview so that the changes in zleveling is shown?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZLevel Ordering
Reply #5 - May 25th, 2010 at 12:41pm
Print Post  
If you are trying to restore ZIndex values in bulk, try to do that in increasing order, because the setter shifts the items positions within diagram.Items. E.g. add all items to a list or array in the order you want them and call this method:

Code
Select All
void SetZOrder(DiagramItemCollection newZOrder)
{
	for (int i = 0; i < newZOrder.Count; ++i)
		newZOrder[i].ZIndex = i;
} 



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


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #6 - May 25th, 2010 at 2:12pm
Print Post  
Hi again.

OK this problem is solved thanks a lot.

But there are two things:

1.) What about Links. When I draw a link it is allways behind all other objects. Can Links also use bringtofront?

2.) When I have a controlNode above another, there is no possibility to select this. Only when I the click behavior of the node is "IgnoreControl" is set. But this I can not set. Even the Handles are not drawn of an object that lies on top of the Z Order.

What can i do?

Thanks again.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZLevel Ordering
Reply #7 - May 25th, 2010 at 2:36pm
Print Post  
1) Sorry, there's no way we can draw the links over hosted controls in Windows Forms.

2) If a hosted control captures the mouse upon MouseMove event, the diagram cannot detect clicks on it to select it. You could try handling some kind of click event raised by the control, e.g. CellClicked in a datagrid, and select the node from the handler.

If you need that tight integration of controls in the diagram and are not tied to a specific control, maybe you should check WPF. Controls and graphics elements are part of the same visual tree there and you can mix them in the Z order, draw handles over the controls, etc.

Stoyan
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #8 - May 26th, 2010 at 6:20am
Print Post  
Thats the problem. We do not want to use WPF in our application.

So what possibilities do I have to bring an image in the background (apart from the backgroundimage property of the diagram). It should be sizable and moveable like the other nodes too. Is there another kind of node/item which I can use in this context?
This is the only place where I need to 1. draw Links above other Items and 2. bring this Item into background (this is allready solved).
But again, we can't  use the backgroundproperty because of User Interaction to the BackgroundImageItem.

Thanks a lot for all the help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZLevel Ordering
Reply #9 - May 26th, 2010 at 6:31am
Print Post  
Do you mean you need to draw a bitmap image and are using a control / PictureBox for that? You could display the image inside a ShapeNode, and set the Transparent property to true to hide the node's shape and show only the image.
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #10 - May 26th, 2010 at 6:40am
Print Post  
I know that this sounds strange Wink but we need a lot of interaction with this Item. User can set Image, Anchoring,... so first it has to be a usercontrol Wink

But I will try to use this shapenode.
Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZLevel Ordering
Reply #11 - May 26th, 2010 at 7:01am
Print Post  
I see Smiley Yet you could use the ImageAlign property instead of anchoring, and there's always custom drawing if ImageAlign is not enough. E.g. you can set CustomDraw = Full instead of Transparent, and then call e.Graphics.DrawImage from the DrawNode handler.

If you need some interactive controls such as sliders to alter the image, you could implement them as ControlNodes attached to the ShapeNode instead of a UserControl - this will let you both draw link and handles over the image, and still have the required interactivity.

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


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #12 - May 26th, 2010 at 8:58am
Print Post  
Thanks. I think that this willl work for me.

I use the Routing Options of the diagram. All Links are routed automatically. Can I exclude some objects from this routing algorithm? So that the shapeNodes for the Background are not used in routing, but controlnodes are used?
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #13 - May 26th, 2010 at 9:05am
Print Post  
Ah its OK. I found the property Obstacle... :-D
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: ZLevel Ordering
Reply #14 - Aug 9th, 2010 at 12:49pm
Print Post  
Hi again.

I work with this proposal:

private void SyncZOrder()
{
foreach (DiagramItem item in diagram.Items)
{
ControlNode host = item as ControlNode;
if (host != null)
host.Control.BringToFront();
}
}

The problem was, that when i click on my ControlNode, the hosted Control was brought to front. With this segment I make thie diagram displaying the nodes in the right z-ordering. Now there is the Problem, that when there are more than five control nodes on the diagram, this segment take a long time. so it takes about a second until the node is selected. this is not usable. does anyone know another way to avoid that "bring to front" "shuffles" the z-ordering of my node (only in display)

I even tried node.Intersects but even when the nodes are way away from each other this functions says Intersects = true...

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