Page 1 of 1

Spelling checker for a rich text editor

Posted: Mon Nov 02, 2020 3:52 pm
by XCoder
The zip files below implement a spell checker for text and RTF files.

It uses the SpellCheck Library produced by PrincieD at https://www.purebasic.fr/english/viewto ... 12&t=49236 with a few minor modifications (Thanks PrincieD). This library uses the popular free Hunspell spelling checker that is provided under a GPL/LGPL/MPL tri-license (https://github.com/hunspell/hunspell).

It also uses the Text Object Model (TOM) to underline mispelt words with a temporary red wavy line (see https://www.purebasic.fr/english/viewto ... 12&t=76203). This has the advantage that:

(1) if the original text contains any underlining then that underlining is automatically restored when the temporary wavy line is removed;
(2) the temporary underlining is not included in a document file when that document is saved.

Extract one of the zip files to an empty folder - you will find that a subfolder called Dictionaries is placed in this folder. This contains English dictionaries. If you want to use dictionaries for other languages (available at https://github.com/wooorm/dictionaries) then they must be placed in this folder.

I have included two Hunspell libraries Hunspellx64.dll and Hunspellx86.dll and these must be kept in the folder with the program that uses the spellchecker.

RTFSpellChecker_Basic.zip
This zip file contains the essentials for spell checking with a rich text editor. When the spell checker runs, it displays a rich text control containing some text with instructions. You can load a rtf file or text file for checking. I have not included a facility for saving the file as this program is really just a demonstration (let me know if you would like the option to save a document included and I may then include it).

Click this link to download the basic version of the spelling checker:
http://www.mediafire.com/file/1s92cd68f ... c.zip/file

RTFSpellChecker_Advanced.zip
This zip file contains extra modules so that when a mispelt word is right-clicked, a pop up menu appears. Use this menu to open a form that displays suggestions for correcting the word (double click the required word in this window). The form also lets you tell the program to ignore the word that is mispelt or add words to a default dictionary (After adding the first word, the default dictionary is created in the subfolder named Dictionaries and is named user.dat).

Click this link to download the more advanced version of the spelling checker:
https://www.mediafire.com/file/1ql9wqzt ... 2.zip/file

Re: Spelling checker for a rich text editor

Posted: Tue Apr 05, 2022 10:17 am
by XCoder
I have updated the advanced version of the spelling checker so that it works correctly with the x64 version of Windows (click the link in the first post to download it).