Page 1 of 1

is there any problem working with two dictionary?

Posted: Fri Feb 24, 2012 2:26 pm
by alexandreq
I noticed that sometimes the routine works fine with two loaded dictionary and sometimes it doesn't. Well, most of the time it doesn't work.

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;

Posted: Fri Feb 24, 2012 2:35 pm
by alexandreq
You can downloaded the Portuguese dictionary from here

http://www.broffice.org/files/pt_BR-2011-05-27AOC.zip

Posted: Fri Feb 24, 2012 4:07 pm
by Sergey Tkachenko
Sorry, we cannot accept bug reports for old version of TRichView.

Did you follow the advices from http://www.trichview.com/forums/viewtopic.php?t=3198 ?