Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / October 2005

Tip: Looking for answers? Try searching our database.

Clear undo stack

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Boni - 30 Oct 2005 19:11 GMT
Dear all,
I do some changes in an active document. Sometimes I have call undo to
remove those changes. After that the appropriate action is visible in a redo
stack. Do I have a chance to remove it from there or at least completely
clear undo and redo stack?
Thanks a lot.
Boni
Rick Strahl [MVP] - 31 Oct 2005 07:26 GMT
I don't think there's an easy way to clear the global undo stack. I don't
think that's a good idea anyway...

For the current operation though you can use set your own UndoContext and
then decide to abort the Undo buffer like this:

try  // Make sure UndoContext gets cleaned up ALWAYS!
{
   this.applicationObject.UndoContext.Open("Insert XML Comment from Help
Builder", false);

   // *** Insert the XML From our Element
   if !this.AddInHelper.InsertXmlComment(Comment, Element)
       this.applicationObject.UndoContext.SetAborted();

}
finally
{
   this.applicationObject.UndoContext.Close();
}

You can set a current UndoContext and then optionally abort it so whatever
you do basically never ends up in the UndoBuffer.

+++ Rick ---

Signature

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

> Dear all,
> I do some changes in an active document. Sometimes I have call undo to
[quoted text clipped - 3 lines]
> Thanks a lot.
> Boni
Boni - 31 Oct 2005 11:49 GMT
Dear Sir,
thanks for an advice. I already tried this solution, it does not fit my
needs. I need to undo my changes in document (in the mentioned cases) and
need that this changes don't apear in redo stack.

> I don't think there's an easy way to clear the global undo stack. I don't
> think that's a good idaea anyway...
[quoted text clipped - 29 lines]
>> Thanks a lot.
>> Boni
Dustin Campbell - 31 Oct 2005 16:22 GMT
> I do some changes in an active document. Sometimes I have call undo
> to remove those changes. After that the appropriate action is visible
> in a redo stack. Do I have a chance to remove it from there or at
> least completely clear undo and redo stack?  Thanks a lot.  Boni

The only way that I can think of to do this is to create your own
custom undo object that implements IOleParentUndoUnit. If you do this,
you can collect the text changes within your object and then you have
complete control over the creation of your object on the redo stack. If
you aren't familiar with this interface, there is great information in
the Platform SDK.

Signature

Best Regards,
Dustin Campbell
Developer Express, Inc


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.