From 8c0b10a61f479d969af14595763c85d15d0bd5a8 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 7 Feb 2017 13:26:36 +0000 Subject: [PATCH] B2016-242: EditorialSpellCheck not working for correcting misspelled words from context menu --- PROMS/Volian.Controls.Library/StepRTB.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 7b04a175..4eda4c25 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -3418,6 +3418,7 @@ namespace Volian.Controls.Library ToolStripItem tsi = e.Menu.Items.Add("Edit Menu"); tsi.Click += new EventHandler(tsi_Click); //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++) { ToolStripItem tsi1 = e.Menu.Items[i]; @@ -3428,10 +3429,32 @@ namespace Volian.Controls.Library tsi2.Click += new EventHandler(tsi2_Click); 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) { C1SpellChecker2.CheckControl(_ContextMenuStepRTB, true, MySpellCheckDlg);