Undo() Method?
-
Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was:
rchTextCode.Undo();
Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()? of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...
-
Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was:
rchTextCode.Undo();
Search the articles for "undo". There are some that cover this topic.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()? of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...
sharpiesharpie wrote:
Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()?
This won't work as the
String
class defines noUndo
method.sharpiesharpie wrote:
of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...
The
Undo
method only operates on the text of the text box (see the documentation). He meant that it undos all changes applied to the text and not all changes applied to the text box itself.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
sharpiesharpie wrote:
Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()?
This won't work as the
String
class defines noUndo
method.sharpiesharpie wrote:
of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...
The
Undo
method only operates on the text of the text box (see the documentation). He meant that it undos all changes applied to the text and not all changes applied to the text box itself.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
Actually, there is a rtf.Text.Undo method...
-
Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was:
rchTextCode.Undo();
I tried and got the Undo() not to undo the whole textbox, but only the latest entry. What I did was I clicked on another object, then clicked on the textbox and added more text. You can probably achieve multi-stepped undo by playing a bit with the TextChanged event from the RichTextBox and changing focus.
Internet - the worlds biggest dictionary
-
Actually, there is a rtf.Text.Undo method...
Mmh, I don't know where you get that.? The
RichTextBox.Text
property returns aString
instance and theString
type definitely has noUndo
method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook