[ExpressSpell] Live spelling in multiple controls

Demos, code samples. Only questions related to the existing topics are allowed here.
Post Reply
Sergey Tkachenko
Site Admin
Posts: 13636
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[ExpressSpell] Live spelling in multiple controls

Post by Sergey Tkachenko » Tue May 12, 2009 7:17 pm

ExpressSpell by Developer Express is supported in TRichView via TRvDxSpellChecker component (RVDXSpell.pas included in http://www.trichview.com/resources/spell/rvspell.zip )

This topic explains how to implement live spelling in multiple controls of different types.
For example, a form contains several TcxMemo components and one TRichViewEdit. We need to activate live spelling for the focused editor.
For DevExpress's controls (such as TcxMemo), live spelling is activated if RvDxSpellChecker1.CheckAsYouTypeOptions.Active = True.
But this option cannot be used in TRichViewEdit.

Solution: add the code below in OnEnter and OnExit events of TRichViewEdit.

Code: Select all

OnEnter:
  RvDxSpellChecker1.CheckAsYouTypeOptions.Active := False;
  RvDxSpellChecker1.UpdateRules;
  RichViewEdit1.StartLiveSpelling;
OnExit:
  RichViewEdit1.ClearLiveSpellingResults;
  RvDxSpellChecker1.CheckAsYouTypeOptions.Active := True;
Live spelling in RichViewEdit is performed as usuall, using OnSpellingCheck event:

Code: Select all

OnSpellingCheck:
  Misspelled := RVdxSpellChecker1.IsMisspelled(AWord);

Post Reply