Undo/redo lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- fmolina · 2020-05-30 15:22 Hi, Is there any support for undo/redo operations? If not, is it planned? Thanks ---------------------------------------------------------------------- wp · 2020-05-31 17:54 No / not in the near future. ---------------------------------------------------------------------- Thaddy · 2020-05-31 18:24 @wp It is already done a long time ago, but the documentation is cryptic: it does not explain it is about undo/redo.... Limitation is published only. It is also Delphi compatible: https://www.freepascal.org/docs-html/rtl/classes/trecall.html E.g. the memo lines are published Tstrings and can use Trecall and actually to quite some depth...Or most of the db related icon properties. ---------------------------------------------------------------------- tonse · 2022-12-31 18:12 Are there any examples of working with TRecall? I have a small program where users need to be able to resize and reposition Panels . SO far so good.. I am just looking for a way to implement an undo/redo function ---------------------------------------------------------------------- Thaddy · 2022-12-31 21:06 Well, then you will have to wait for next year... Happy New Year ---------------------------------------------------------------------- dbannon · 2023-01-01 05:19 Its not hugely hard to implement yourself. Its just a case of working what are the changes you want to 'undo' and storing a representation of them on a circular buffer. I made a undo/redo unit for KMemo, https://github.com/tomboy- notes/tomboy-ng/blob/master/source/tbundo.pas - its almost certainly no direct use to you unless you use KMemo but it  might give you a few ideas to follow up on. KMemo, being a text thingo, is text focused. Sounds like you will want to record control positions, just a case of, perhaps, making a record that contains the name of a control, its position. Poke that record into the buffer each time someone moves moves things. On undo, Pop each record back out and restore the control to the position recorded in the popped record. Obviously, some housekeeping is required, you need to manage the most recent and oldest record, decide when to throw away the oldest to make room for a new one. And probably implement some sort of delay before recording a new record to make sure the user has finished moving ... Davo ---------------------------------------------------------------------- Thaddy · 2023-01-01 09:26 Dead giveaway: It is a stack. (or basicallly a singly linked list) If you can't write a stack you are not a programmer.( Yet ) Happy new year! p.s.  I propose you order https://www.amazon.com/Tomes-Delphi- Algorithms-Data-Structures-ebook/dp/B007FKB0EI although that may seem a blatant advert, it is not! all example code compiles with FreePascal. There are many more links about algorithms and data structures. You will NEED that knowlege at some point. Use a TStack............