473,379 Members | 1,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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 7801
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****************@TK2MSFTNGP11.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: teisATdraibyDOTcom

regards, Teis

----- Original Message -----
From: "Paul E Collins" <fi******************@CL4.org>
Newsgroups: microsoft.public.dotnet.languages.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
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...
5
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...
6
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...
2
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...
3
by: babylon | last post by:
any facilities in csharp that can help me implmenting undo/redo in my application? thx
2
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...
3
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...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.