Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ShapeNode Text undo/redo (Read 1955 times)
hhko
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Feb 9th, 2010
ShapeNode Text undo/redo
Feb 22nd, 2010 at 4:15am
Print Post  
I chaged ShapeNode of Text.
but. this can't support undo/redo.

Code
Select All
private void DiagramNodeDoubleClickedEvent(object sender, NodeEventArgs e)
	  {
		ShapeNode shape = e.Node as ShapeNode;
		if (shape == null) return;
		shape.Text = "temp";	  //<--- undo/redo?
	  }
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Text undo/redo
Reply #1 - Feb 22nd, 2010 at 10:38am
Print Post  
Hi,

You must use the ChangeItemCmd class to implement property undo/redo operations. The constructor of the class records the initial state of the item and the Execute method records the final state and adds the ChangeItemCmd object to the undo manager's history:

Code
Select All
ChangeItemCmd propChange = new ChangeItemCmd(shape, "Change");
shape.Text = "temp";
// ... possibly other property assignments
propChange.Execute(); 



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