It works fine when I load only one dictionary.
Is There anything wrong with my code?
Code: Select all
procedure TFTMNLeitor.FormCreate(Sender: TObject);
begin
// Creating a spell checker component
RVdxSpellChecker1 := TRVdxSpellChecker.Create(Self);
RVdxSpellChecker1.OnSpellFormAction := RVdxSpellChecker1SpellFormAction;
CarregaDicionario('dic\pt_BR.aff','dic\pt_BR.dic',1046, 1252,2,HaDicPT); // Portuguese Dictionary
CarregaDicionario('dic\en_US.aff','dic\en_US.dic',1033, 0, 1,HaDicUSA); // English Dictionary
LoadedDicnary := True;
if (HaDicUSA=False) and (HaDicPT=false) Then LoadedDicnary := False;
End
procedure TFTMNLeitor.CarregaDicionario(aff, dic : string; Lang, pag, tipo: Integer; out HaDic: Boolean);
const
DictionaryClasses: array[0..2] of TdxCustomSpellCheckerDictionaryClass = (TdxHunspellDictionary, TdxOpenOfficeDictionary, TdxISpellDictionary);
var
ADictionaryItem: TdxSpellCheckerDictionaryItem;
begin
If FileExists(aff) and FileExists(dic) Then HaDic := True
Else HaDic := False;
if HaDic Then Begin
PopupMenu1.AutoHotkeys := maManual;
// Adding ISpell English dictionary
ADictionaryItem := RVdxSpellChecker1.DictionaryItems.Add;
ADictionaryItem.DictionaryTypeClass := DictionaryClasses[tipo];
with TdxISpellDictionary(ADictionaryItem.DictionaryType) do begin
if aff<>'' Then GrammarPath := aff;
if dic<>'' Then DictionaryPath := dic;
Language := Lang;
if tipo=2 Then Begin
CodePage := pag;
end;
End;
RVdxSpellChecker1.LoadDictionaries;
RVdxSpellChecker1.UpdateRules;
End;
end;