[squeak-dev] Undoable environment ?

itsme213 itsme213 at hotmail.com
Tue Apr 29 17:36:46 UTC 2008


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






More information about the Squeak-dev mailing list