2009. július 29., szerda
How to fill the undo buffer with the content of a TMemo
Problem/Question/Abstract:
When I type into a TMemo and then press ctrl+Z as usual, the last change is removed. But if I programmatically add text through memo1.seltext := 'newtext'; the ctrl+Z does not work. Why is this and is there a workaround?
Answer:
That's the way MS designed the multiline edit control to work. There is no way to tell it programmatically to save the current content to the undo buffer, you can only tell it to clear the undo buffer or to undo the last operation.
A hack that may work to trick it into filling the undo buffer is this.
{ ... }
with memo1 do
begin
perform(WM_CHAR, 32, 0);
sellength := -1;
seltext := someText;
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése