Home Forums General XMetaL Discussion Undo in XMAX 5.5 Reply To: Undo in XMAX 5.5

Dominik G.

Reply to: Undo in XMAX 5.5

We have integrated the XMAX control for our product into eclipse and do also a lot of manipulation stuff via the COM API.
In many situations we call one action inside our client that causes multiple XML manipulations and range/select movements.
If the user wants to undo this action he/she has to click undo for each manipulation.

I know there is a method undo([intNumberOfTimes]) that can achieve exactly this, but counting the manipulation steps is not as trivial as it seems in some situations.
We have actions where multiple 'listeners' can do something with the content that should be all undone by one undo() call.
Furthermore what is if an XML manipulation has no effect (attribute does not exist on the given element, element is read only, …).
Should this manipulation call increase the 'intNumberOfTimes' count or not? The range and selection changes have to be also considered of course.
I think counting the manipulation steps is really error prone.

Would it be possible to add a beginUndo() and endUndo() method?

The beginUndo() method specifies the beginning of an undo block. This means that all statements between this call and its corresponding endUndo() method call will be undone by a single call to the undo() method.

This behaviour would be exactly the same like the handling of a macro, if I understand your previous comments right, but it would also work for API manipulation calls.
Doing all the stuff inside a macro is not possible for us.

Reply

Products
Downloads
Support