Using WSpell with a third-party edit control

You are here: Home > Support > WSpell

Problem: When you set WSpell's TextControlHWnd property to the handle of a third-party text control, nothing happens, or the results aren't as you expect.

Discussion: WSpell communicates with the control being checked through standard messages such as WM_GETTEXTLENGTH and WM_GETTEXT. This technique works with standard text and rich-text boxes. Unfortunately, many third-party controls do not respond to these messages, or they respond in non-standard ways.

Solution: The solution is to add code in your application to "bridge the gap" between WSpell and the third-party control. An example of this technique can be found in the "Check 3rd Party" demo included with the WSpell example programs (e.g., see the wspell\vb\example directory). The Check 3rd Party demo uses a regular edit control (text box), but the technique applies to most third-party controls as well.

The technique works as follows

  1. Extract plain, unformatted text from the the control into a string, then set WSpell's Text property to the value of the String.

  2. Set WSpell's ShowDialog property to True, and set the ShowContext property to False. This causes WSpell to display its built-in dialog box to interact with the user to dispose of spelling errors. (The Local Dialog demo does not use the built-in dialog, but rather a dialog implemented in the example application. Either approach can be used with this technique.)

  3. Call WSpell's Start method.

  4. Catch the MisspelledWord, DeleteWord, WordWithDigits, MixedCaseWord, Capitalization, and ConditionallyChangeWord events. See "How to highlight misspelled words" in the "Using WSpell" chapter of the WSpell Programmer's Guide for instructions on what to do when these events are caught.

  5. Catch the ReplaceWord and DeleteWord events. See "How to update the checked document" in the "Using WSpell" chapter of the WSpell Programmer's Guide for instructions on what to do when these events are caught.

See Using WSpell with TX Text Control for instructions on dealing with that specific control.

Wintertree Software Inc.

Site index:


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


Copyright © 2015 Wintertree Software Inc.