B2016-242: EditorialSpellCheck not working for correcting misspelled words from context menu

This commit is contained in:
Kathy Ruffing 2017-02-07 13:26:36 +00:00
parent 83c3a69a89
commit 8c0b10a61f

View File

@ -3418,6 +3418,7 @@ namespace Volian.Controls.Library
ToolStripItem tsi = e.Menu.Items.Add("Edit Menu"); ToolStripItem tsi = e.Menu.Items.Add("Edit Menu");
tsi.Click += new EventHandler(tsi_Click); tsi.Click += new EventHandler(tsi_Click);
//Now replace their "Spell" item with ours, so that we can display our custom spell check dialog //Now replace their "Spell" item with ours, so that we can display our custom spell check dialog
bool onword = true;
for (int i = 0; i < e.Menu.Items.Count; i++) for (int i = 0; i < e.Menu.Items.Count; i++)
{ {
ToolStripItem tsi1 = e.Menu.Items[i]; ToolStripItem tsi1 = e.Menu.Items[i];
@ -3428,9 +3429,31 @@ namespace Volian.Controls.Library
tsi2.Click += new EventHandler(tsi2_Click); tsi2.Click += new EventHandler(tsi2_Click);
e.Menu.Items.Insert(i, tsi2); // add our spell check dialog item e.Menu.Items.Insert(i, tsi2); // add our spell check dialog item
} }
else
{
// B2016-242: check for editorial change on spell check word click.
// Add an event to any context menu items that have a corrected word.
// Note that a line separates corrected words from menu item selections
// and the line does not have any text. So once we hit the line, don't add
// event handler to flag the user selected to use the correction.
if (onword) e.Menu.Items[i].Click += new EventHandler(spellcheckWord_Click);
if (e.Menu.Items[i].Text == null || e.Menu.Items[i].Text == "") onword = false;
} }
} }
} }
}
static void spellcheckWord_Click(object sender, EventArgs e)
{
ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
if (tsmi != null)
{
// B2016-242: because this is a static method, the format flag for EditorialSpellCheck cannot be checked
// before setting 'DidEditorialSpellCheck'. But the format flag is checked before the 'DidEditorialSpellCheck'
// is actually used in rtbitem.
DidEditorialSpellCheck = true;
}
}
static void tsi2_Click(object sender, EventArgs e) static void tsi2_Click(object sender, EventArgs e)
{ {