I'm trying to use events OnCheckAsYouTypeStart and OnCheckControlInContainer to allow or prevent from spell check in cxTRichViewEdit but seems it not work correctly even if you try code below SpellChecker continue to works in focused cxTRichViewEdit.
We do not support DevExpress' "check as you type" mechanism.
When TRvDxSpellChecker checks TcxTRichViewEdit, it automatically deactivates "check as you type" mechanism, and assigns OnSpellingCheck event.
Ok, so I'm trying to disable spell check from OnSpellingCheck event with Misspelled variable, but it doesn't affect spell check, how can I enable\disable spell check for certain RV ?
procedure TRvDxSpellCheckerCheckAsYouTypeManager.InitializeController(
AControl: TWinControl);
begin
if AControl is TCustomRichViewEdit then
begin
FStoredCheckAsYouTypeOptions := SpellChecker.CheckAsYouTypeOptions.Active;
SpellChecker.CheckAsYouTypeOptions.Active := False;
FEditor := TCustomRichViewEdit(AControl).GetRootEditor;
(SpellChecker as TRvDxSpellChecker).UpdateRules;
FOldOnSpellingCheck := FEditor.OnSpellingCheck;
if FStoredCheckAsYouTypeOptions then
begin
FEditor.OnSpellingCheck :=
(SpellChecker as TRvDxSpellChecker).DoRVSpellingCheck;
FEditor.StartLiveSpelling;
end
else
begin
FEditor.ClearLiveSpellingResults;
FEditor.OnSpellingCheck :=nil;
end;
end
else
inherited;
end;
After this change, it should not start live spelling in TRichViewEdits if SpellChecker.CheckAsYouTypeOptions.Active = False;
Please inform me if this code works as expected. If yes, I'll make this change official.
Yes, the events are still not called, because "CheckAsYouType" mechanism is not supported directly.
However, if you assign RVDXSpell.CheckAsYouTypeOptions.Active = False, cxTRichViewEdit is not checked any more.
It's not a solution, because if set RVDXSpell.CheckAsYouTypeOptions.Active = False then you can't enable spell check when you need it with same RVDXSpell.CheckAsYouTypeOptions.Active = True.
I really don't want to make dynamic RVDXSpell or change any proprietary sources code ))))