diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 1b2c616c..921988fb 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1796,6 +1796,18 @@ namespace Volian.Controls.Library } //static bool _ShowChanges=false; int _LastTop = 0; + + // Bug Fix: B2017-059 only turn on the spellchecking if the RTB is visible. This controls the number of windows handles created durning spellchecking + private void TurnOnSpellCheckIfVisible() + { + if (MyStepRTB != null) + { + if (this.Top + this.Height > 0 && this.Top < MyStepPanel.Height) + MyStepRTB.SpellCheckStatus = true; + else + MyStepRTB.SpellCheckStatus = false; + } + } /// /// Handles movement of the EditItems /// @@ -1803,6 +1815,7 @@ namespace Volian.Controls.Library /// private void EditItem_Move(object sender, EventArgs e) { + TurnOnSpellCheckIfVisible(); int newTop = Top - MyStepPanel.TopMostEditItem.Top; //if(_ShowChanges && _LastTop != newTop && MyItemInfo.InList(134786)) //Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,"\"EditItem_Move\"\t\"\"\t\"{0}\"\t{1}\t{2}\t{3}",MyItemInfo.ShortPath, MyID, Top, _LastTop); diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index a80af32b..fa7ec067 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -805,11 +805,30 @@ namespace Volian.Controls.Library Console.WriteLine("StepRTB_ContextMenuStripChanged {0} - {1} [{2}]", ex.GetType().Name, ex.Message, sublocation); } } + + // Bug fix B2017-059, toggle the spellchecking status on only when being used - to control how many window handles are created by the spellchecker + // This fixed the issue of the spell checker closing PROMS - Callaway SAMG Background TSG-1, also reproduced on long procedure in calvert EOPs + + private bool _SpellCheckStatus = false; + + public bool SpellCheckStatus + { + get { return _SpellCheckStatus; } + set + { + if (_SpellCheckStatus != value) + { + _SpellCheckStatus = value; + if (DoSpellCheck) + C1SpellChecker2.SetActiveSpellChecking(this, value); + } + } + } + private void SetUpStepRTB() { DetectUrls = false; - if (DoSpellCheck) - C1SpellChecker2.SetActiveSpellChecking(this, true); + SpellCheckStatus = false; this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables BorderStyle = System.Windows.Forms.BorderStyle.None; this.ScrollBars = RichTextBoxScrollBars.None; @@ -3494,8 +3513,8 @@ namespace Volian.Controls.Library public bool SpellCheckNext() { int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg); - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck) - DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck) + DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode return (nBad >= 0); // nBad = -1 means user pressed Cancel button } diff --git a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs b/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs index 0945a9bb..b02f9476 100644 --- a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs +++ b/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs @@ -105,10 +105,22 @@ namespace Volian.Controls.Library { // fire load event base.OnLoad(e); - + //AddHandle(); // show first error (after firing load event) ErrorIndex = 0; } + // added for debugging - comment out when not using + //public void AddHandle() + //{ + // if (!Handles.Contains(this.Handle)) + // { + // GC.Collect(); + // Handles.Add(this.Handle); + // Console.WriteLine("Handles {0}, RTB Count Created {1}, RTB Count Not Disposed = {2} ", Handles.Count,StepRTB.CountCreated,StepRTB.CountNotDisposed); + + // } + //} + //private static List Handles = new List(); private bool _Initializing = false; private string _OrgWord; @@ -257,6 +269,7 @@ namespace Volian.Controls.Library private void btnIgnoreAll_Click(object sender, EventArgs e) { + //Console.WriteLine("handle: {0}", this.Handle); _Spell.IgnoreList.Add(CurrentError.Text); _Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start); UpdateCurrentError();