<< Click to display table of contents >> TRVSpellChecker |
This component checks spelling in TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit controls, as well as in ScaleRichView (TSRichViewEdit, TDBSRichViewEdit controls).
In FireMonkey, this component can also be used as a platform service to check spelling in other controls (like TEdit and TMemo).
Unit [VCL/FMX] RVSpellChecker / fmxRVSpellChecker.
Syntax
TRVSpellChecker = class(TComponent)
TObject
TPersistent
TComponent
If a spelling checking service is available, IsAvailable returns True.
AvailableLanguages returns a list of codes of supported languages (dictionaries). To display them to the user, use FillLanguageNames method.
To select a language (dictionary), assign a language code to Language property, or a language index to LanguageIndex property.
The active language (dictionary) is returned by CurrentLanguage or LangugeIndex.
You can check the editor by registering it using RegisterEditor method.
If you do not use RichViewActions, call Execute method.
If you use RichViewActions:
▪place TRVSpellChecker, TRVSpellInterface, TRVAControlPanel components on a form;
▪assign RVSpellInterface1.SpellChecker = RVSpellChecker1
▪assign RVAControlPanel1.SpellInterface = RVSpellInterface1
▪add TrvActionSpellingCheck in TActionList and assign it to a button or to a menu item.
The actions add spelling checking command to a popup menu (TRVAPopupMenu), initiates checking on clicking a button or a menu item, localizes spelling checking dialogs.
You can use “sow-level” methods:
▪IsWordValid – checks a word for spelling errors (can be used in OnSpellingCheck event of editors)
▪Suggest returns suggestions to correct a misspelled word
▪AddToAutoReplaceList – “Replace All” command
▪AddToIgnoreList – “Ignore All” command
▪AddToDictionary – “Add to Dictionary” command
This component can be used as a platform service to check spelling on other FireMonkey editors, see RegisterAsService.
You can use GetAutoCorrection method to get an auto-correction for the specified word.
If you use RichViewActions:
Use TRVSpellInterface component (see “recommended use” above). Call RVSpellInterface1.AutoCorrectInKeyDown in the editor's OnKeyDown event, and RVSpellInterface1.AutoCorrectInKeyPress in the editor's OnKeyPress event.
You can use GuessCompletions method to get possible completions for a word.
This feature is not used by TRichView editors.
Unless you use this component via RichViewAction's TRVSpellInterface component, all UI text in spelling checking dialogs are in English.
If you want to localize forms yourself, you can use OnSpellForm event.
Platform |
Used Tool |
---|---|
Windows |
System spelling checking (ISpellChecker), available since Windows 8 |
macOS |
System spelling checking (NSSpellChecker) |
iOS |
System spelling checking (UITextChecker) |
Linux |
Hunspell (may require installation) |
Android |
– |
Not all features available for all platforms, see SupportsFeatures.