You can also have a look at the Iterator DP in the Smalltalk companion they have an hisotrystream to manipulate commands and do undo. On Apr 29, 2008, at 7:36 PM, itsme213 wrote:
I have commands that I would like to make undoable. Is it possible to wrap the commands within an "undoable" environment as suggested in http://www.ceteva.com/forum/viewtopic.php?t=17
I imagine something like this (but wouldn't know where to start):
A>>setFoo: aFoo Undoable newOn: [ foo := aFoo ]
A>>setBar: aBar Undoable newOn: [ bar := aBar ]
a := A new foo: 0; bar: 0; yourself. a setFoo: 5. a setBar: 10. Undoable undo. "a bar == 0" Undoable undo. "a foo == 0" Undoable redo. "a foo == 10"
Thanks - Sophie