This message contains graphics. If you do not see the graphics: Graphic Version.
 
Using the WSpell spelling checker with TX Text Control

In this short newsletter, we are going to show you how to add spell checking capabilities to your TX Text Control application, using the popular ActiveX spell checker, Wintertree WSpell

To use this sample, you need to have both of the following components (trial or full versions) installed on your PC:

  • TX Text Control ActiveX (any edition)
  • WSpell Spelling Checker ActiveX

You can download the free TX Text Control trial version from:

The following sample is written for Visual Basic 6. It is however not difficult to make a few changes to get it working in Delphi or Internet Explorer, as our sample code has only been slightly modified from the shipped sample application from Wintertree.

The WSpell custom dialog uses a TextBox control, which can simply be replaced by TX Text Control. Having done that, there are only a few lines of code that need to be altered. The ReplaceWord callback method is called when WSpell wants to replace a misspelled word with a corrected one.

WSpell can only check raw text without formatting, we therefore need to be sure that the attributes of the replaced words are preserved. We do this with the following code:

Private Sub WSpell1_ReplaceWord() Dim Start As Long Start = WSpell1.WordOffset ' Replace the misspelt word. Keep first character to preserve formatting TextControl.SelStart = WSpell1.WordOffset + 1 TextControl.SelLength = Len(WSpell1.MisspelledWord) - 1 TextControl.SelText = WSpell1.ReplacementWord ' Now delete first character TextControl.SelStart = Start TextControl.SelLength = 1 TextControl.SelText = "" End Sub

First of all, the the starting position of the misspelled word in the text is saved to a variable. Secondly, the word is selected in TXTextControl, but the first letter of the word is skipped. Thirdly, the selection is replaced with the new word. Finally, the first letter, which had been skipped, gets deleted.

UPDATE (July 24, 2003): The folks at Wintree Software have kindly posted a page describing the integration of WSpell in TX Text Control.

We wish you a lot of success with this sample application. As always, we are delighted to help you with any matter relating to TX Text Control. Call us or e-mail us! Full contact details at:


Best regards

The Newsletter Team

Text Control GmbH respects your online time and privacy. We only send this newsletter to TX Text Control customers and people who have signed up to receive it. However, if you would prefer not to receive future issues of the newsletter, you may unsubscribe at any time. If you received this newsletter forwarded from a colleague or friend, you may wish to subscribe directly.

Sent to: N/A.

Imprint | Unsubscribe | Subscribe

© 2003 Text Control GmbH. All Rights Reserved.