
Spellex SDK for ActiveX - Technical Support
Applies to: Spellex ActiveX 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 Spellex ActiveX 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:
-
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.
-
Set Spellex ActiveX's MisspelledWord property to the word under the mouse cursor.
-
Call the IgnoreAllWord method.
You can implement the Add item in your context menu as follows:
-
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.
-
Call the AddToUserDictionary method.
Calling the IgnoreAllWord or AddToUserDictionary methods will not change the misspelled status of the word until Spellex ActiveX re-evaluates the word's spelling status. Spellex ActiveX 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:
-
Determine the offset or character position of the character under the mouse cursor in the control being monitored
-
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.
-
Call Spellex ActiveX's CheckBackgroundNotify method.
-
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.
-
Call Spellex ActiveX'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 | Order Now | Products | Upgrades | Free Trial | Partners | About Spellex | Contact Us | Site Map | Privacy Policy
Spellex Corporation © 2008. All rights reserved












