Page 1 of 1

RvDxSpellChecker some events not work with cxTRichViewEdit

Posted: Fri Nov 06, 2015 5:01 pm
by 11111
hi,

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.

Code: Select all

procedure TForm1.RvDxSpellChecker1CheckAsYouTypeStart(Sender: TdxCustomSpellChecker; AControl: TWinControl; var AAllow: Boolean);
begin
  AAllow := False;
end;

procedure TForm1.RvDxSpellChecker1CheckControlInContainer(Sender: TdxCustomSpellChecker; AControl: TWinControl; var AAllow, AContinue: Boolean);
begin
  AAllow := False;
  AContinue := False;
end;
It's bug ?

Posted: Fri Nov 06, 2015 5:14 pm
by Sergey Tkachenko
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.

Posted: Fri Nov 06, 2015 5:29 pm
by 11111
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 ?

Posted: Sun Nov 08, 2015 9:13 am
by Sergey Tkachenko
Try changing TRvDxSpellCheckerCheckAsYouTypeManager.InitializeController in RVDXSpell.pas:

Code: Select all

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.

Posted: Mon Nov 09, 2015 7:54 pm
by 11111
Unfortunately given solution not working :(

Checker still underline wrong words in focused cxRV

Posted: Tue Nov 10, 2015 8:23 am
by Sergey Tkachenko
I cannot reproduce the problem.

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.

Posted: Tue Nov 10, 2015 8:46 pm
by 11111
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 ))))