Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic About Zorder (Read 5239 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
About Zorder
Feb 24th, 2011 at 2:09pm
Print Post  
I wnat change z order of my custom nodes.

I use this for send to back:

form.ActiveItem.ZBottom();


form.UpdateLayout();

And this code for send to front:

form.ActiveItem.ZTop();


form.UpdateLayout();

This work abslutly in erratic way.
Example i create a big squaqre node, and the put inside another more littel suqre inside

I select little node, and run   form.ActiveItem.ZBottom();

The little node over the big node dont go to back, the only way to do that is select the big node and send to front.

This no have logic
What im doing wrong?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: About Zorder
Reply #1 - Feb 24th, 2011 at 2:31pm
Print Post  
By default selected nodes are drawn on top of Z order. Try setting diagram.SelectionOnTop = false.

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


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: About Zorder
Reply #2 - Feb 24th, 2011 at 2:59pm
Print Post  
private void form_NodeActivated(object sender, NodeEventArgs e)

{

form.SelectionOnTop = false;



This not work, same result.
I create custom node is a square, then put a a second node square inside.

I select the little suqare and try send back, that not work, but if i select the big square and select send to front, work, now little suqare is hiiden by big suqare node....

But now i want send that big suare node, to back again and not work!

If want i uplaod and example tellme, this is a bug?
Can you test and confirm.

Rememebr im working with custom nodes, not with shapenodes provided by mindfusion component.

Anyway i tested this with simple shapes and same happen, i think is a bug or a conceptual error of how z order should work.
Or some mistake form me, but like you see in code aparently this time im doing in correct way : )




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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: About Zorder
Reply #3 - Feb 24th, 2011 at 3:18pm
Print Post  
Are you sure your form_NodeActivated method ever runs? Set SelectionOnTop in the diagram's Xaml code, it's a global property for the diagram and you should not have a reason to change it.

Code
Select All
private void OnNodeClicked(object sender, NodeEventArgs e)
{
	if (e.MouseButton == MouseButton.Right)
		e.Node.ZTop();
	else
		e.Node.ZBottom();
} 



With SelectionOnTop set to false I handled the NodeClicked event as above, and couldn't see any problems with this after drawing several overlapping nodes and clicking with different mouse buttons to send nodes back and forth in the Z order.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: About Zorder
Reply #4 - Feb 24th, 2011 at 4:39pm
Print Post  
Like always you have reason my mistake again!
Fixed, thank you , anyway new question born of all this.

If i selected with control more of one node, and i try change zorder of all that nodes at same time, not work.

Baiscally is due i working with  Activeitem, example

form.ActiveItem.ZBottom();

Exist some method to work with SelectedItems ?


I see same problem whe work with keyboard arrows up , , left down and right and try move multile selected items with keys. etc etc
Best regards.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: About Zorder
Reply #5 - Feb 24th, 2011 at 5:18pm
Print Post  
Iterate over diagram.Selection.Items:

foreach (DiagramItem item in diagram.Selection.Items)
     item.ZBottom();

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


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: About Zorder
Reply #6 - Feb 24th, 2011 at 10:35pm
Print Post  

Your example work perfect for move in z order multiple nodes selected, but what about move with keyboard?

DiagramNode node = form.ActiveItem as DiagramNode;
               if (node != null)
                   node.Move(node.Bounds.X -1, node.Bounds.Y);

How move multiple items and not single?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: About Zorder
Reply #7 - Feb 25th, 2011 at 7:28am
Print Post  
Likewise, iterate over Selection.Nodes and call node.Move from the loop body.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: About Zorder
Reply #8 - Feb 25th, 2011 at 9:17am
Print Post  
Thankyou work perfect !
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint