Author Topic: Undo function (TEdit)  (Read 1450 times)


  • Hero Member
  • *****
  • Posts: 2048
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Undo function (TEdit)
« Reply #15 on: February 25, 2024, 01:34:41 pm »
Is this why the simplest text editor can be tens of megabytes in size?
My simplest self made (ansi/low featured/closed source/windows 32bit) text editor is about 50kb in size written without any framework.
With framework it depend on what's your target OS you compile for, for Windows 64bit a simple but feature rich edition would be around 5mb.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »


  • New Member
  • *
  • Posts: 30
Re: Undo function (TEdit)
« Reply #16 on: February 25, 2024, 02:01:42 pm »
Yes guys, thank you very much!
Of course I know what the stack is for :)

The question is a little different.
Here's an example:
|Text            |

Then the user quickly presses keys 1,2,3
|Text123       |

What should be on the stack?
1) ----------




Isn't there a difference between using the [<-] backspace key and going ctrl-Z for Undo?

If you have just pressed keys 123 quickly and not pressed Enter, you can press [<-][<-] key and type 132 as you intended.  I assume that is built into Windows and every other version of a Textbox or other standard controls.

If you have already pressed Enter, the box now contains"Text123" and need to amend, that is where ctrl-Z might be useful and no it would not backspace by one Char, but perhaps revert to a previous state.  That could be revert the contents to "Text" or perhaps to put the cursor back in the edit box.

BUT surely Undo can not be a method of the TEdit but of the whole form.  Because once you have left the form by pressing Enter, it is the Form that has focus and receives the ctrl-Z keypress.  So the stack would need to contain which control was last used to make changes as well as what the changes were.

of course I may be wrong.


TinyPortal © 2005-2018