Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic UndoManager (Read 5409 times)
alfrye
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Sep 30th, 2009
UndoManager
Jun 1st, 2011 at 7:13pm
Print Post  
I am using the UndoManager to record actions that can be undone however I am having the following problem,. I have method where I am calling currentDiagram,UndoManager,StartCoposite("test");

and I have some code in between the start and execute and that calls out to another method and that method is removing part the of a diagram link and creating a new diagramlink.

when I try to undo the steps the new diagramlink is remove however the step where I remove part od the line is not being recorded. I have tried creating a new composite command and adding it as a subcommand and that does not seem to work.

Any help would be greatly appreciated.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #1 - Jun 2nd, 2011 at 7:08am
Print Post  
If you mean you are changing the link's ControlPoints / SegmentCount properties, you will have to explicitly create a ModifyItemCmd for that and add it to the composite.

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


I love YaBB 1G - SP1!

Posts: 16
Joined: Sep 30th, 2009
Re: UndoManager
Reply #2 - Jun 2nd, 2011 at 1:36pm
Print Post  
Thanks Stoyo!!

Do I need to create the ModifyItemCmd command in my main method or the method that is called to clear the controlpopints of the link.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #3 - Jun 2nd, 2011 at 2:07pm
Print Post  
Hi Alan,

You should create a ModifyItemCmd just before changing ControlPoints, and call its Execute method after that. It should not matter what method creates it, as long as there is a distinct instance for each change.

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


I love YaBB 1G - SP1!

Posts: 16
Joined: Sep 30th, 2009
Re: UndoManager
Reply #4 - Jun 2nd, 2011 at 2:22pm
Print Post  
Hi Stoyo,

That is what I thought however the Execute method of the ModifyItem Class in protected virtual . Will changeItem also work or do I have to ModifyItem.
  
Back to top
AIM  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #5 - Jun 2nd, 2011 at 2:43pm
Print Post  
Sorry, you should actually call Diagram.ExecuteCommand(cmd). That will also add the command to the current composite.

Stoyan
  
Back to top
 
IP Logged
 
alfrye
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Sep 30th, 2009
Re: UndoManager
Reply #6 - Jun 2nd, 2011 at 2:47pm
Print Post  
Thanks Stoyo!!

I was able to get the my issue resolved by using a ChangeItem command. The reason it was not working before was beacuse I has the create change command in the wrong place. Wink
  
Back to top
AIM  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #7 - Jun 2nd, 2011 at 2:54pm
Print Post  
Yes, it will do too but might save/restore more stuff than necessary. ModifyItem only saves the item's position, and Change saves all other properties as well. Not a big deal anyway Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint