general undo methods?

Geoff Canyon gcanyon at inspiredlogic.com
Sat Feb 19 13:29:22 EST 2005


I would store a list of transcript statements designed to undo/redo the 
things you are doing. So if you move a rectangle to 100,300 I would get 
the long id of the rectangle and do something like this:

put "set the loc of" && it && "to" && tNewLoc & cr after gRedoString
put "set the loc of" && it && "to" && the loc of it & cr before 
gUndoString
set the loc of it to tNewLoc

I did something like this for fields and found it to be remarkably fast 
and efficient. The really great aspect is that you can undo/redo an 
arbitrary number of steps with one command: do line 1 to 100 of 
gUndoString undoes 100 steps, etc.

On Feb 18, 2005, at 1:40 PM, Richard Gaskin wrote:

> I can see how that approach would be useful for some apps, but this 
> one has a large stack and the changes made a very small (moving 
> objects, deleting objects, etc.).
>

regards,

Geoff Canyon
gcanyon at inspiredlogic.com



More information about the use-livecode mailing list