Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Undo button
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00146106
Message ID:
00149092
Views:
29
>>>I'd go with a Command class, as described in "Design Patterns."
>>
>>Actually Mark, wouldn't the problem be solved better with a Memento pattern?
>
>Memento saves states, Command saves commands. I think either would be workable here (although GHJ&V give an example of Undo with the Command pattern).
>
>The thing about Command is that it supports the concept of a command (no matter how it was produced), with the capability of undoing that command. I once wrote an editor (a vi clone) that simply saved the keystrokes for each editing action, and replayed them in "undo" mode to undo their actions.
>
>But your suggestion is good, too.

I guess I was focussed on the example code where a value was being restored from an array: this seemed more like a state.

Isnt it interesting how the patterns overlap?
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform