I am using spelling with TRichViewEdit. Because of customer's request I need to use MS Word speller through COM.
Now- my spellingcheck event looks something like this:
Code: Select all
procedure TfmeTEXT.rveSpellingCheck(Sender: TCustomRichView;
const AWord: string; StyleNo: Integer; var Misspelled: Boolean);
var
ATemp: TStrings;
begin
if FNonVisible or not Self.Visible or (csDestroying in rve.ComponentState) then exit;
ATemp := TStringList.Create;
try
try
Misspelled := not dmMain.SpellChecker.CheckSpelling(AWord, ATemp, false, true);
except
Misspelled := false;
end;
finally
ATemp.Free;
end;
end;
Now- in order to make it work (since Word COM is being called from spelling thread I had to add following lines to unit which contains Spellchecker object):
Code: Select all
initialization
if Assigned(ComObj.CoInitializeEx) then
OleCheck(ComObj.CoInitializeEx(nil, COINIT_MULTITHREADED))
else
CoInitialize(nil)
finalization
CoUninitialize;
BTW- if I comment initialization/finalization part of Spellchecker object live spelling obviously doesn't work, but RichView behaves as it should. So it's not a problem of properties assigned to RV...
LP, Primoz