Hi again!
Let's say that I don't have menuItems at all and no shortcuts as well.
If I set ReadOnly to "false" to both components, then I'm able to use Ctrl+Z
as "Undo feature" only in my Warning Box, but NOT in my Code Box! The only
difference between those two boxes is that there are lots of parsing
elements in my Code Box for Syntax HighLighting.
Your parsing does not use "RichTextBox.Text {get; }" ?
If "Text" will be get from RichTextBox, that control
lose UNDO possibility.
I agree that this could be a bug whatsoever... Thanks for your help, Marcin!
If this UNDO problem doesn't solve i can propose You to write
your own UNDO/REDO component, with extended functionality
(e.g. unlimitet/limitet count of undo/redo levels).
Marcin
--------------------------------------
try this code: two RichTextBoxes and three buttons on a new
WindowsApplication form.
public Form1() {
// leave generated code
InitializeComponent();
// add those lines
button1.Click+=new EventHandler(button1_Click);
button2.Click+=new EventHandler(button2_Click);
button3.Click+=new EventHandler(button2_Click);
}
private void button1_Click(object sender, System.EventArgs e) {
this.DoUndo(richTextBox1);
}
private void button2_Click(object sender, System.EventArgs e) {
this.DoUndo(richTextBox2);
}
private void DoUndo(RichTextBox richTxtBox) {
if( richTxtBox.CanUndo ) {
richTxtBox.Undo();
}
else {
MessageBox.Show(this
, "There's no undo on: " + richTxtBox.Name);
}
}
private void button3_Click(object sender, System.EventArgs e) {
MessageBox.Show(this
, String.Format("{0}||||{1}"
, richTextBox1.Text
, richTextBox2.Text));
}