Page 1 of 1

[ExpressSpell] Live spelling in multiple controls

Posted: Tue May 12, 2009 7:17 pm
by Sergey Tkachenko
ExpressSpell by Developer Express is supported in TRichView via TRvDxSpellChecker component (TRichView Setup installs it automatically, if ExpressSpellChecker is already installed)

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);
If you use our special controls (TcxTRichViewEdit), they do this work automatically, no additional code is needed.