general undo methods?

Richard Gaskin ambassador at fourthworld.com
Sat Feb 19 03:54:34 EST 2005


Martin Baxter wrote:
> The only time I did this seriously was a while back and in Hypercard. I had
> a specialised multimedia authoring environment for teaching purposes that
> (among other things) implemented a custom interface to addColor. I used the
> approach you describe above, but instead of storing state information, I
> stored a statement that could be executed, using Do, which would reverse
> the action in question. So for example if the user created a rectangle, the
> undo list would contain something to the effect of:
> 
> delete graphic "grcname"
> # (I forget the actual syntax now that it no longer matters)
> 
> It worked well, and allowed the actual undo handler to be very short and
> very dumb. As has been noted however, different types of undo action may
> require a range of strategies.

That seems to be the simplist approach. Tedious to setup on an existing 
app, but it does seem to represent the most useful dividing lines 
between centralizing code and handling a wide range of circumstances.

Off to go write libUndo....

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list