Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undo functions

Status
Not open for further replies.

JeroenNL

Programmer
Nov 28, 2002
217
NL
Hi there,

I would like to have Undo and Redo functions in my program. I'm searching for general methods of these functions. Does anybody know good ways to implement Undo/Redo?

Thanks!
Jeroen
 
What sort of things would you want to Undo/Redo? What operations does your program perform? Clive [infinity]

Don't forget what Christmas is all about: not [santa2] but Jesus!
 
I'm writing a graphical application in which I can draw and manipulate 3d objects. For example, I've drawn a 3d cube and now I move it across 3d space (by selecting the cube, then select the Move command and then dragging the mouse across the screen). I would like to Undo this command. Another example: a 3d cube has 6 faces. Suppose I delete on of these faces. How to Undo that operation?

I'm looking for a general solution, if there is such a thing for Undo operations.

Thanks in advance!
Jeroen

P.s See for more info btw
 
Hello

The easiest way to make the engine perform multi-level undos, is to have it understand a simple scripted language. So that every 3D object is composed of a number of operations. e.g

A command to the engine might look like :

Rotate( -1, 45)

this being a simple rotation 45° anti-clockwise. To perform the Undo you would have to create an Undo 'engine' which would issue the opposite effect to the orignal command :

Rotate(1, 45)

Having the engine parse human readable commands will make your life far easier for debugging. You could of course keep issuing Undos until the object is removed and the script is empty, using this method would also allow Undo-ing to be available even after the object has been saved and reloaded.

Dudley Brooke
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top