rvico TRichView Reference | Overview

Live spelling check

Top  Previous  Next

Live spelling check marks misspelled words with special underlines (wavy line of TRVStyle.LiveSpellingColor color).

Spelling check is executed in background thread.

Starting and finishing spelling check

In TRichView:

Spelling check is started by calling StartLiveSpelling method.

In TRichViewEdit:

Spelling check is started:

by calling StartLiveSpelling method or
when user modifies document or when any editing-style method is called (if LiveSpellingMode=rvlspOnChange)

Spelling check is stopped by ClearLiveSpellingResults method.

Checking Words

RichView Package does not have its own spelling check engine and dictionaries. You need to use third-party components.

Currently the following components are supported:

1.Addict3 by Addictive Software (shareware Delphi component)
2.EDSSpell 7.0 by OneDomain, Inc (shareware Delphi component)
3.VSSpell 8.0 by ComponentOne LLC (shareware ActiveX)
4.VSSpell 3.0 by Visual Components, Inc (shipped with Delphi, ActiveX)
5.ASpell by Kevin Atkinson (DLL, license: LGPL)
6.LS Speller by Luzius Schneider (ISpell + MS Office (CSAPI) spell checkers, freeware)

Let me know if you are interested in supporting other spelling checkers.

Files required for these spell-checkers can be downloaded from Resources for RichView web page.

The live spelling thread calls OnSpellingCheck event for each word in the document.

Word is defined as a run of characters between delimiters.

Single quote character is processed specially: if it's inside word, it's treated as a part of word (for example "it's" or "I'll"). If it's to the left/right, it's treated as a delimiter.

URLs are ignored, see RVIsCustomURL function.

Making Corrections

Call LiveSpellingValidateWord if user added word in a custom dictionary or ignore list.

Call GetCurrentMisspelling to get or to correct the current misspelled word. For example, you can use this method to implement popup menu:

1.when context menu is about to be shown, use GetCurrentMisspelling to get misspelled word in the caret position and to generate suggestions;
2.when the user has chosen a suggestion, use GetCurrentMisspelling again to select the misspelled word and use InsertText to insert replacement.

Alternatively, misspelled word can be selected on the step 1 (before displaying popup menu).

Memory Usage

Live spelling support adds 8 extra bytes per each item. If you do not use it, you can compile your application with RVDONOTUSELIVESPELL compiler define (see RV_Defs.inc file)


RichView © Sergey Tkachenko