Creating functions for Undo and Redo?
BlitzMax Forums/MaxGUI Module/Creating functions for Undo and Redo?
| ||
Greetings, I'm trying to figure out how to create some functions for Undo and Redo to be used with a TextArea gadget. I noticed in the MaxIDE code there are some Types that have related code to this, but in the last few hours of trying to study it and follow the chain of events, I've been unable to extract the knowledge I need. Can anyone help walk me through this? Better yet, maybe we can make a module of it so that we can create functions that blend in with the current functions of: GadgetCut(gadget:TGadget) GadgetCopy(gadget:TGadget) GadgetPaste(gadget:TGadget) So we would add GadgetUndo(gadget:TGadget) GadgetRedo(gadget:TGadget) Any help or insight either way is seriously appreciated. Thanks, -Garrett |
| ||
Thinking out aloud. Couldn't you create a function wrapping SetTextAreaText? Create an object containing a field which holds the text added and have a variable point to the link for that object.. When you undo use prevlink and redo nextlink until you're at the top/bottom of the chain. Each time you undo/redo remove/add the text from the object at that link. |