Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Compositecmd (Read 1471 times)
billcollis
YaBB Newbies
*
Offline


I love mindfusion

Posts: 19
Location: Auckland, NZ
Joined: Jun 4th, 2011
Compositecmd
Jul 4th, 2013 at 5:50am
Print Post  
I have a diagram with 4 hidden tables that hold data.
I want to implement undo and redo, and to ignore the changes in the tables;
however compositecmd doesn't seem to be working for me.

I wrap the code creating the tables in
   CompositeCmd composite = new CompositeCmd(diagram, "maketables");
   //code to make tables is here
   composite.Execute();

however when I look at diagram.UndoManager.History.Commands[.]
I get 9 commands
  Create
  Change table
  Create
  Change table
  Create
  Change table
  Create
  Change table
  maketables

this same happens when a table is modifed in the program, I get 'Change table' for each modification I make

any ideas why compositecmd is not catching these changes?
Should I try and keep track of when this happens and use MergeUndoRecords() to fix it
thanks
Bill
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Compositecmd
Reply #1 - Jul 4th, 2013 at 6:58am
Print Post  
Hi,

Call UndoManager.StartComposite() to create an active composite command that captures internal commands such as the ones created by Factory.CreateTableNode. You need to create a CompositeCmd instance via the new operator only when you'll be explicitly adding child commands to it.

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