Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Undo of a Grouped Node (Read 2051 times)
corcav
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Apr 1st, 2009
Undo of a Grouped Node
Apr 1st, 2009 at 12:57pm
Print Post  
I need to create a diagram made up of aggregates node, that's why I've created a grouped node using AttachTo to add child nodes that should stay in front of parent node.
I add nodes to the diagram programmatically using Nodes.Add(...)

Problem 1: Node don't stay in front even if i use Zindex=1 on 'child' nodes, i have, after adding the node to Nodes collection, to set ZIndex=0 (it works only after node has been added)

Problem2: If i delete the gropuped node and the invoke Undo, child nodes aren't in front and i have no idea of how to bring it in front.

Thanks
Corrado
  
Back to top
 
IP Logged
 
corcav
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Apr 1st, 2009
Re: Undo of a Grouped Node
Reply #1 - Apr 1st, 2009 at 1:19pm
Print Post  
BTW: This code (taken from the forum) reproduces the problem:

// Implicitly created undo records will be saved here
CompositeCmd composite = this.diagram1.UndoManager.StartComposite("Create group", true);
// Call methods that create undo records
ShapeNode node1 = diagram1.Factory.CreateShapeNode(0, 0, 130, 130);
ShapeNode node2 = diagram1.Factory.CreateShapeNode(0, 0, 30, 30);
Group g = diagram1.Factory.CreateGroup(node1);
g.AttachProportional(node2, 10, 10, 40, 40);
// Save the active composite in history
composite.Execute();
node1.SubordinateGroup.AutoDeleteItems = true;

If i delete the group and invoke Undo, child element is behind node2, and i have to click it to bring it forward
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo of a Grouped Node
Reply #2 - Apr 1st, 2009 at 1:35pm
Print Post  
The code above preserves the Z order for redoing or undoing the create operation. You must use a similar StartComposite("Delete group", true) call when calling Nodes.Remove() to preserve the Z order when doing undo/redo of delete operations.

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


I love YaBB 1G - SP1!

Posts: 17
Joined: Apr 1st, 2009
Re: Undo of a Grouped Node
Reply #3 - Apr 1st, 2009 at 1:49pm
Print Post  
Thanks Stoyan,
Since i don't call Nodes.Remove() programmatically but i use FlowChart default behavior, is there a way to inject those statements or do i have to intercept Delete key and add the code myself?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo of a Grouped Node
Reply #4 - Apr 1st, 2009 at 2:19pm
Print Post  
Try that with version 5.2.1. I believe we have implemented this there after this thread:
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=123748554...

You might also set DelKeyAction = None and handle keydown for Del to delete the nodes yourself.

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


I love YaBB 1G - SP1!

Posts: 17
Joined: Apr 1st, 2009
Re: Undo of a Grouped Node
Reply #5 - Apr 1st, 2009 at 2:56pm
Print Post  
Thanks Stoyan,
I'll have a look at it.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint