Page 1 of 1

Two RichViewEdits & Live Spelling with Addict

Posted: Fri Feb 09, 2018 12:08 am
by clarktechinc
I have the RVAControlPanel, RVStyle and the Addict Software components (RVAddictSpell31, and RVAAddictSpellInterface) on a DataModule serving all my TRichViewEdit components throughout the application.

On one form, I have two RichViewEdit components with their respective Toolbars with TRichViewActions activated. Whenever a user starts to use one of the two RichViewEdits, I "Activate" the RichViewEdit in the OnEnter event of the RVE and connect the respective RichViewEdit to the RVAControlPanel.DefaultControl. I Activate the RVAControlPane, reformat the RVE and then StartLiveSpelling. This "Activation" process is called for each of the RichViewEdit components in the OnShow event of the form.

In the second RVE, the spelling errors are highlighted as expected however in the first RVE, the errors are not identified. When entering misspelled words in either RVE, the errors are not identified. If I invoke RVActionSpellingCheck I receive the corrections dialog for some of the misspelled words but not recently entered words.

I appreciate that the Live Spelling is running in a separate thread but I have examined the code for the StartLiveSpelling method and it appears to terminate the thread, clear the past results and start the spelling again at the start of the document.

Have I encountered an issue within the implementation of TRVAAddictSpellInterface or the Addict engine itself ? If not, what am I missing? Does the Addict engine need to be stopped then restarted when switching between RVEs like this?

--------------------------------------------------------------------

The "ActivateRVE" procedure follows:

PROCEDURE TDMRichView.ActivateRVE(CONST MyForm: TForm; CONST MyRichViewEditor: TRichViewEdit;
CONST MyRuler: TRVRuler = NIL);

VAR
UniqueName: STRING;

BEGIN
dDMRichView.locActiveRVEForm := MyForm;
UniqueName := MyForm.Name + myRichViewEditor.Name;
IF (dDMRichView.locActiveRVEName <> UniqueName) THEN
BEGIN
dDMRichView.locActiveRVEName := UniqueName;
// Set up the Form itself
MyForm.Font.Charset := RVA_GetCharset;
Screen.HintFont.Charset := RVA_GetCharset;
Screen.MenuFont.Charset := RVA_GetCharset;
RVA_LocalizeForm(MyForm)
{ Localizing all actions on this panel's form' };
//
{ Set up the RVEdit }
dDMRichView.gblActiveRVE := myRichViewEditor;
// Set some standards
DMRichView.RVAControlPanel1.DefaultControl := myRichViewEditor;
DMRichView.RVAControlPanel1.Activate; // force the change?????
// Notes Events - not used but included for completeness
DMRichView.rvActionEditNote1.Control := myRichViewEditor;
//
myRichViewEditor.FormatAll { format the RVE based on above };
// connect the Ruler
dDMRichView.locActiveRVERuler := MyRuler;
IF Assigned(MyRuler) THEN
MyRuler.RichViewEdit := myRichViewEditor;
END { if anything needed to be updated or reassigned };
END;


When entering the RVE the OnEnter event code for the first RVE is:
PROCEDURE TfrmTest3.RichViewEdit1Enter(Sender: TObject);
BEGIN
DMRichView.ActivateRVE(frmTest3, RichViewEdit1, NIL);
RichViewEdit1.StartLiveSpelling;
END;

Re: Two RichViewEdits & Live Spelling with Addict

Posted: Fri Feb 09, 2018 3:18 pm
by clarktechinc
My Apologies. I have subsequently discovered that for the first RVE on the form, I had not assigned the OnSpellingCheck event. My RVE initialization procedure reacts to the "RVEType" (one "type" has a background, the other "type" did not) and one of RVE "types" did not properly assign he OnSpellingCheck event.

Once the second RVE "type" had its OnSpellingCheck event assigned, my ActivateRVE procedure functioned as I expected and I was able to switch the RVAControlPanel to the "active" RVE as I intended.

I was considering adding a second RVAControlPanel, RVAAddictSpellInterface and PopUpMenu on the DataModule to support the second RVE on the form but it appears to be unnecessary.