RvDxSpellChecker some events not work with cxTRichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
11111
Posts: 25
Joined: Sat Feb 07, 2015 12:02 pm

RvDxSpellChecker some events not work with cxTRichViewEdit

Post 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 ?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
11111
Posts: 25
Joined: Sat Feb 07, 2015 12:02 pm

Post 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 ?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
11111
Posts: 25
Joined: Sat Feb 07, 2015 12:02 pm

Post by 11111 »

Unfortunately given solution not working :(

Checker still underline wrong words in focused cxRV
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
11111
Posts: 25
Joined: Sat Feb 07, 2015 12:02 pm

Post 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 ))))
Post Reply