473,809 Members | 2,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple undo/redo implementation in C#?

I'm looking for some information (books, articles, tutorials) on how to
implement a multiple undo/redo framework. I'm a beginner in this so I prefer
information specifically targeting C# with code samples. Is seems that the
'Command Pattern' is the way to achieve it (?).
If you know any good resources I would be very happy to know!

Thank you very much!,
Teis
Nov 16 '05 #1
3 7833
Hi Teis,

It depends on your program as there is no universal solution.
Here are some hints:
The idea is, that you store all actions you want to undo (in some sort of
collection).
When user wants to undo, you go through stored actions in reverse order and
undo actions one by one.
Of course, you'll have to provide undo/redo functionality.

I don't know of any resources, sorry.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Teis Draiby" <te************ *@draiby.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I'm looking for some information (books, articles, tutorials) on how to
implement a multiple undo/redo framework. I'm a beginner in this so I prefer information specifically targeting C# with code samples. Is seems that the
'Command Pattern' is the way to achieve it (?).
If you know any good resources I would be very happy to know!

Thank you very much!,
Teis

Nov 16 '05 #2
"Teis Draiby" <te************ *@draiby.com> wrote:
I'm looking for some information (books, articles,
tutorials) on how to implement a multiple undo/redo
framework. [...]


I use two classes, an UndoFrame (representing an action that was performed)
and an UndoStack. The UndoStack has two regular C# Stack objects: an undo
stack and a redo stack.

When the user carries out an action, push its new UndoFrame onto the undo
stack and clear the redo stack. When the user undoes an action, pop the undo
stack and push the action being undone onto the redo stack.

If this isn't enough information, mail me and I'll send you some code.

P.
Nov 16 '05 #3
Hi Paul
If this isn't enough information, mail me and I'll send you some code. Oh, yes please! I've found some articles out there but not much sample
code - so I'd like to
see some examples.
You can mail me at: teisATdraibyDOT com

regards, Teis

----- Original Message -----
From: "Paul E Collins" <fi************ ******@CL4.org>
Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
Sent: Saturday, April 24, 2004 5:14 PM
Subject: Re: Multiple undo/redo implementation in C#?

"Teis Draiby" <te************ *@draiby.com> wrote:
I'm looking for some information (books, articles,
tutorials) on how to implement a multiple undo/redo
framework. [...]
I use two classes, an UndoFrame (representing an action that was

performed) and an UndoStack. The UndoStack has two regular C# Stack objects: an undo
stack and a redo stack.

When the user carries out an action, push its new UndoFrame onto the undo
stack and clear the redo stack. When the user undoes an action, pop the undo stack and push the action being undone onto the redo stack.

If this isn't enough information, mail me and I'll send you some code.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3024
by: Jay | last post by:
I need to implement an undo and redo for an entire row in a listview containing approximately 10 columns. I'm not sure of the best way to implement this. The only thing that I've thought of is a stack implementation. I need to be able to undo a delete, an insert (add), a movement within the list Any ideas? Thank you and any ideas would be appreciated.
5
3782
by: Mickel Grönroos | last post by:
Hello everybody I'm developing a tool in Tkinter and would like to add Undo and Redo commands to my Edit menu. Does somebody know if anybody has implemented standard Undo/Redo as a Python module? I could not find any info with Google on the matter. Cheers, Mickel Grönroos
6
8099
by: lkrubner | last post by:
I'm offering users the ability to type weblog posts into a form and post them. They type the text into a TEXTAREA which is on a form. The form, when submitted, hits a PHP script. Before it is submitted, while they are typing, I'm trying to offer them some common word processing functions. I want to implement unlimited undo and redo for the textarea. I've set the textarea to onChange="addToArrayOfPastWork()"; My undo button gives me...
2
2121
by: Tony Nelson | last post by:
I'm looking for a "pythonic" GTK Undo library/class. It would have a framework for Undo/Redo, and would provide Undo/Redo for TextView, Entry, and containers and other classes. In a "batteries included" fashion, just instantiating a "UndoableTextView" or "UndoableEntry" or "UndoableContainer" would provide Undo and Redo in the right-click menu; simply connecting such an object to an "UndoableUIManager" would take care of the stock items...
3
11639
by: babylon | last post by:
any facilities in csharp that can help me implmenting undo/redo in my application? thx
2
13272
by: Christian H | last post by:
Hello, I've tried to find information about how to implement an Undo/Redo pattern. This article describes such a pattern: http://www.codeproject.com/csharp/PcObjectUndo.asp , but is a little bit to narrow, since it only can handle 1 object, and since it only works on properties. What if you , in an application, have more than 1 object , and you want to use undo/redo on them?
3
3171
by: GoogleEyeJoe | last post by:
Dear ladies and gents, I'm trying to determine whether the .NET Framework implements a means of transactional processing without the need for a database. Essentially, I'd like to enlist light-weight portable business objects within transactions so that that have the ability to roll-back if the client of the object wishes to undo any changes made. For example, if I had a, let's say for sake of simplicity, a person class that had two...
1
4054
by: anupam roy | last post by:
Hi All, I want to perform basic Edit menu functionalities on my custom design surface. While all the Cut/Copy/Paste/Deelete/Select functionalities working fine with code below,Undo/Redo standard commands are not working for me. IMenuCommandService menusrv= HostControl.HostSurface.GetService(typeof(IMenuCommandService)) as IMenuCommandService; if (menusrv != null) { switch (editstring) ...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.