Implementing UNDO

Klaus major-k klaus at
Fri May 21 11:19:48 EDT 2021

Hi Paul and all,

> Am 21.05.2021 um 17:05 schrieb Paul Dupuis via use-livecode <use-livecode at>:
> As other have said, the basic mechanism is to have a UNDO LIFO (last in first out) queue or stack (no LC stack for a data structure stack). For each action you want 'undoable" you need a handler (do[action] ) to perform that action that also adds a record (a line) to the queue (a property, global variable, or script variable) that puts enough information in that record to undo the action. You then you have a corresponding undo[action] handler that can take the record from the queue and reverse the action.
> So records on the queue might look like:
> changeFont <oldFont> <newFont> <chunk>  -- which can be undone by setting the <chunk> to <oldFont>
> resizeImage <oldSize> <newSize>
> etc.
> The first item tells you action was done and the subsequent items provide enough information to undo (or do again or redo) the action.

thank you very much for all the hints and examples!
Great inspiration and very encouraging. :-)



Klaus Major
klaus at

More information about the use-livecode mailing list