Page 1 of 1

HunSpell

Posted: Wed Mar 13, 2024 3:48 pm
by armagnac
Hi,

I try to install this functionnality in my project.
I put on the form a RVAHunSpellInterface, a RVHunSpell, a RVAControlPanel and I affect properties.
When I run the program I get an error in

procedure TRVAHunSpellInterface.DoSpellFormLocalize(Sender: TRVHunSpell;
Form: TfrmRVCustomSpell_);
begin
LocalizeSpellForm(Form, FControlPanel);
end;

It seems the FControlPanel is nil, but I don't see where I can affect my RVAControlPanel into the TRVAHunSpellInterface : no property published, no procedure to set the RVAControlPanel as FControlPanel.

Thank you for your help

Re: HunSpell

Posted: Wed Mar 13, 2024 8:50 pm
by Sergey Tkachenko
Do you call RVHunSpell.Check() yourself?
If you assigned RVHunSpell to RVAHunSpellInterface.HunSpell, you should not call RVHunSpell.Check() (because it will attempt to localize a spell-checking dialog and will fail).

Instead, use TrvActionSpellCheck action. This action assigns RVAHunSpellInterface.FControlPanel temporary while checking.

If you still need to call RVHunSpell.Check() yourself, assign RVAHunSpellInterface.HunSpell = nil, perform spelling checking, then restore.

Re: HunSpell

Posted: Sat Dec 06, 2025 10:01 am
by armagnac
Hi, impossible to get a "normal" correction, always crash in LocalizeSpellForm because the parameter ControlPanel is nil.

Here the code into the OnCreate of the Form :

// --- 1) Configurer Hunspell ---
RVHunSpell1.DllDir := RepAppli;
RVHunSpell1.DllName := 'hunspell.dll';
RVHunSpell1.DictDir := RepAppli; // contient fr_toutesvarantes.aff et .dic
RVHunSpell1.SpellFormStyle := rvhfClassic;

// --- 2) Interface Hunspell ---
RVAHunSpellInterface1.HunSpell := RVHunSpell1;

// --- 3) SpellChecker ---
RVSpellChecker1.Language := 'fr';
RVSpellChecker1.SpellFormStyle := rvsfsClassic;

// --- 4) SpellInterface ---
RVSpellInterface1.SpellChecker := RVSpellChecker1;

// --- 5) Enregistrer l'éditeur ---
RVSpellChecker1.RegisterEditor(rve);

// --- 6) Activer le soulignement live ---
rve.LiveSpellingMode := rvlspOnChange;

// --- 7) Activer Hunspell à la fin ---
RVHunSpell1.Active := True;

and then the Correction.OnClick method :

RVSpellChecker1.Execute(rve);

What I do wrong ? Thank you

Re: HunSpell

Posted: Sat Dec 06, 2025 4:19 pm
by Sergey Tkachenko
1) If you do not use RichViewActions, do not use RVAHunSpellInterface1. The form will be shown with default (English) messages.

2) If you use RichViewActions, create TRVAControlPanel component and assign RVAHunSpellInterface1 to its SpellInterface property.

The simplest solution: use TrvActionSpellingCheck action. Assign it to Correction.Action. The action automatically uses SpellInterface, you do not need to process Correction.OnClick.

Alternative solution: instead of RVSpellChecker1.Execute(rve), call RVAHunSpellInterface1.Check(rve, RVAControlPanel).