Incorrect event firing

You are here: Home > Support > WSpell

If your application catches MisspelledWord, WordWithDigits, MixedCaseWord, Capitalization, or ConditionallyChangeWord events, it should not call the Resume method from the event handler. Calling the Resume method from the event handler for one of these events may cause spurious events to occur or may cause events to be fired in the wrong order (e.g., a MisspelledWord event may be fired after an EndOfText event).

The WSpell programmer's guide (version 5.8 and earlier) in the section titled "How to check spelling" states that the Resume method should be called to continue checking. However, the following clarifications must be made:

  1. The Resume method should not be called from within the event handler for the reasons noted above.

  2. If the ShowDialog property is true, the Resume method should not be called. Once the Start method has been called, the built-in spell check dialog will take over and will continue running until all words have been checked or the user presses the Cancel button on the dialog.

If your application needs to catch one of the above-named events and does not use the built-in spell check dialog (i.e., sets the ShowDialog property to False), then it should call the Resume method in a loop which terminates when the EndOfText event is fired. The following code fragments show how this is done:

Private Sub SpellCheckButton_Click()
Dim rslt As Integer
    ' Check the context of TextBox1
' endOfTextFired is a global Boolean variable
WSpell1.Text = TextBox1.Text
endOfTextFired = False
    rslt = WSpell1.Start
While (Not endOfTextFired And rslt >= 0)
rslt = WSpell1.Resume
Wend
End Sub
Private Sub WSpell1_EndOfText()
endOfTextFired = True
End Sub

Back to WSpell Support Page

Wintertree Software Inc.

Site index:


[Home] [Products] [Catalog] [Ordering] [Search] [Contact Us]


Copyright © 2015 Wintertree Software Inc.