Zunbeltz wrote:
I am planning to implement undo/redo capabilites in my application. What
ways are in wxpython to do this?
There isn't anything specific in wxPython. Your actual implementation
will depend on your underlying data structure and format.
The simplest brute force method is to save a copy of the data with
each step taken and switch to it on undo/redo.
A more thorough approach is to store a transaction log. You store
the data in its current state, and then have a list of function
calls and parameters to undo/redo.
For example, say the user types in "Hello", and then deletes item 3.
You would store the results of that, and a transaction log of:
data.Add, 3, "whatever it was"
data.Remove, "Hello"
Note the transactions are the opposite of what the user did, but applying
them to the current data will get you back to where you were.
You can get more sophisticated by storing a description of each change
and if done really well even allow applying them in a different order.
You can also save the undo/redo log to disk.
Roger