Wintertree Software Inc.

WSpell ActiveX Spelling Checker

Home Site index Contact us Catalog Shopping Cart Products Support Search

You are here: Home > Support > WSpell > Forcing re-evaluation of words during background checking


Forcing re-evaluation of words during background checking

Applies to: WSpell Version 5.15 and later

Question: I want to display my own context menu when the user right-clicks over a misspelled word during background checking. How can I implement the Ignore All and Add (to user dictionary) menu items? Specifically, how do I make WSpell unmark a misspelled word after that word has been ignored or added?

Answer: First, you can implement the Ignore All item in your context menu as follows:

  1. Obtain the word under the mouse cursor. Hint: obtain a block of text from the control before and after the character under the mouse cursor, and examine the block of text to determine the word boundaries.

  2. Set WSpell's MisspelledWord property to the word under the mouse cursor.

  3. Call the IgnoreAllWord method.

You can implement the Add item in your context menu as follows:

  1. Obtain the word under the mouse cursor. Hint: obtain a block of text from the control before and after the character under the mouse cursor, and examine the block of text to determine the word boundaries.

  2. Call the AddToUserDictionary method.

Calling the IgnoreAllWord or AddToUserDictionary methods will not change the misspelled status of the word until WSpell re-evaluates the word's spelling status. WSpell re-evaluates the spelling status of a word after the caret (selection point) moves from inside the word to outside the word. You can force the caret to move into and out of the word using the following approach:

  1. Determine the offset or character position of the character under the mouse cursor in the control being monitored

  2. Set the starting position of the control's selection to the character position determined in the previous step. Set the length of the control's selection to 0.

  3. Call WSpell's CheckBackgroundNotify method.

  4. Set the starting position of the control's selection to a character position outside of the word under the mouse cursor. For example, if the character positioin is 123, and the word under the mouse character is 5 letters long, setting the selection start position to 118 (123 - 5) or 128 (123 + 5) will move the selection outside the word.

  5. Call WSpell's CheckBackgroundNotify method.

The CheckBackgroundNotify method will detect that the caret moved outside the word, and will re-evaluate the word in case a change was made that might affect the word's spelling status. In this case, because the word was ignored or added to a user dictionary, it is no longer considered misspelled so the CheckBackgroundNotify method will unmark the word.


Home Site index Contact us Catalog Shopping Cart Products Support Search


Copyright © 2015 Wintertree Software Inc.