Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic UndoManager can Ignore box.Move()? (Read 2695 times)
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
UndoManager can Ignore box.Move()?
Nov 23rd, 2007 at 12:24pm
Print Post  
Hy stoyo.

I'm trying to move a box when the lane where the box is contained is modified. But i'd like that FlowChart.UndoManager will ignore this operation.

Code
Select All
private void grid_CellBoundsChanged(object sender, CellBoundsEventArgs e)
{
  ....

    box.Move(box.BoundingRect.X,(e.NewBounds.Top + box.Distance));

  ....
}

 


In this event i want that UndoManager ignore box.Move. Is it possible?

Tanks.

  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: UndoManager can Ignore box.Move()?
Reply #1 - Nov 23rd, 2007 at 1:04pm
Print Post  
As an alternative, is possible to have access to

flow.UndoManager.History.Commands[index] parameters?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager can Ignore box.Move()?
Reply #2 - Nov 23rd, 2007 at 1:30pm
Print Post  
Hi,

Try to filter out the ModifyItemCmd created for the box movement. Set some boolean flag before you start moving the boxes, and in the ActionRecording event handler set Cancel = true when that flag is set and the typeof(command) is ModifyItemCmd.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: UndoManager can Ignore box.Move()?
Reply #3 - Nov 23rd, 2007 at 1:51pm
Print Post  
Perfect. Tanks
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: UndoManager can Ignore box.Move()?
Reply #4 - Nov 23rd, 2007 at 2:01pm
Print Post  
Is also possible set the point where the undoManager will move the box after undoManager.Undo()?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager can Ignore box.Move()?
Reply #5 - Nov 26th, 2007 at 7:44am
Print Post  
The node position won't be restored if you filter the command when ActionRecording is raised. You could create a composite command that contains all ModifyItemCmd instances created by the Move method, and also add to it your own command object that resizes the lane grid when undone or redone. Then calling Undo or Redo will move all nodes and resize the lane as a single operation.

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