is there any problem working with two dictionary?

General TRichView support forum. Please post your questions here
Post Reply
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

is there any problem working with two dictionary?

Post 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;
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post by alexandreq »

You can downloaded the Portuguese dictionary from here

http://www.broffice.org/files/pt_BR-2011-05-27AOC.zip
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

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