Attaching operations to the Undo stack

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Matt Whitfield
Version: 4.0.0280
Avatar
I am trying to attach operations to the Undo/Redo stack - in that one of the operations in my app is a refactoring operation. This updates multiple text ranges, and puts a line indicator against each one with a custom icon. The multiple updates are grouped on the undo/redo stack, and what I would like to be able to do is remove those indicators when an undo is performed, or put them back when a redo is performed.

There is a Tag property on UndoRedo, but not on IUndoableModification, and the Name property is read-only. Is there a property somewhere I'm missing?

Thanks

Comments (4)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

We implemented a CustomData property that gets persisted with the WPF version's undoable stack data, but don't have something similar on WinForms at this time. We eventually hope to move our newer .NET 2.0 text/parsing library back to the WinForms SyntaxEditor once it is finalized, so this feature would come with that.


Actipro Software Support

Posted 15 years ago by Matt Whitfield
Avatar
Ok lovely - in the mean time, how would I best achieve my goal? Currently I have just set it so that the relevant indicators are cleared when an undo operation occurs - is that the best I can do in lieu of a Tag property right now?

Thanks
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Matt,

There is a SyntaxEditor.DocumentUndoRedoStateChanged event. Perhaps you can handle that since it tells you when undo/redo operations occur. It also tells you when modifications are added/merged and if the stacks are cleared. So really with that event you may have all the info you need to maintain your own undo/redo stacks that contain the information you are trying to track and keep them in sync with the real text-based undo/redo stacks.


Actipro Software Support

Posted 15 years ago by Matt Whitfield
Avatar
I'm hooked into that one already - but creating a whole mirror of the stack sounds like a lot of work! I think i'll settle with the lame way until the object model is updated...

Thanks!
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.