Help Needed.

Aug 12, 2009 at 12:05 PM

Hello,

I have created an application that allows users to design the layout of an IVR by dragging objects onto a canvas, similar to the way you can do in visio.

When a user drags an object onto the canvas the system generates a unique name for the objects and assigns it to the Name property which is defined as follows.

internal readonly UndoRedo<string> fStepName = new UndoRedo<string>("");

Now i dont want the user to see or be able to undo the initalization of this object so i can use the UndoRedoManager.Clear() method to do this.

The problem is that it totally clears out any undo redo actions in the undo and redo lists :( and i dont want this to happen as the user could of added many objects to the design canvas or made numerous changes previously.

So my question is, is there a way to change a property value without it being put on the undo \ redo command stack or a method i am missing that will allow me to just clear the last command from the stack.  Unfortunately the StartInvisible does not work as the user can undo this.

Thanks.

Aug 12, 2009 at 12:12 PM

Hi Scott. It’s been a while since I looked at the library but I believe you can use the StartInvisible command and this will not register it as part of the undo list.

Aug 12, 2009 at 2:52 PM

Digboy :)


Thanks for your prompt reply, very much appreciated, however, the StartInvisible command is not suitable as although it does not appear in the undo stack that would be visible to the user, it is still in there and will be undone when the proceeding visible command is undone.

Could really do with something Like StartWithNoUndo() or EditPropertyValue() :)

I am hoping the developer of this library will pick this up and find a solution as i hate deviating too far from origonal code if i have to make modifications.

This is a fantastic library that has possibly saved me months of development work implementing Undo Redo from scratch.

Thanks.

Apr 20, 2011 at 8:26 PM

I realize this is quite an old post, but has anyone come up with a solution for this?

(Just to summarize...)

I'd like a UndoRedoManager.StartWithNoUndo(), so that the objects just act like normal objects, no undo history, no exceptions on changing values.

 

Thanks,

Brian

Coordinator
Nov 13, 2011 at 12:18 AM
Edited Nov 13, 2011 at 12:20 AM

Guys,

I believe that you having these issues because something wrong with application design. 

to GreatBigBrain: If you do not want a property to participate in Undo/Redo command, then just make it as a regular property, do not use UndoRedo<> class to declare it.

to scottgblood: In your case you have to make a single command where you will initialize the object and drag it into canvas. do not make to separate command to initialize the object.

-----

In general, you cannot have non-undoable change in the middle of sequence of undoable changes:

undoable change 1
undoable change 2
undoable change 3
non-undoable change A
undoable change 4
undoable change 5 

it simply breaks the common sense. Just pretend what what will be if we rollback to the point "undoable change 2"...
Will it be the an equivalent of state after original "undoable change 2"??? Answer is no.
It will be an "undoable change 2" + "non-undoable change A". It breaks the whole concept of the COMPLETE and CONSISTENT rollback. 

If this concept does not correspond to your design -- believe me: something is wrong with the design, not with the concept.

I created an application with canvases and draggable objects. I stumbled against the same "issues". Eventually I came up to the right design where non-undoable part of application has to be TRANSISTENT and CALCULATABLE from undoable part. It means application must be able to restore its complete state and appearance SOLELY from undoable part. 

In some exceptional cases when you have some data that cannot be undone - it should not interfere with undoable data anyway. But if you cannot avoid the dependency and undoable data DEPENDS ON non-undoable data, then command stack has to be cleared when non-undoable data changes. But it is a rare situation, MUCH more likely you just got wrong design. Reconsider twice before you decide you having this case.