1) Firstly, I must clarify. TRichTextParamContent is a TWinControl. And its have "inplace editor" - instance of TRichViewEdit (FInplaceEditor field). FInplaceEditor is creating in SetParent of TRichTextParamContent instance. So inplace editor in TRichTextParamContent it is not the same inplace editor in TRichViewEdit.
So that I do not call ClearLiveSpellingResults of inplace editor of TRichViewEdit, but call its for TRichViewEdit.
Well, I am not sure that is needed to call this method in this context, I was follow your advise from this post:
http://www.trichview.com/forums/viewtop ... highlight=
you wrote:
However, if you have your own operations that are not started from Clear and use non-editing methods, you should be careful (call ClearLiveSpellingResults before them).
Is I don't understand you and I should not call ClearLiveSpellingResults in this case?
2)
a) in TSpellChecker.IsMisspelled, StyleNo is really the index of Editor.Style.TextStyle (may be incorrect Editor is passed as the parameter)
Unfortunately, this is one of errors, wich we can't repeat. So I will insert assertions to check TSpellChecker.IsMisspelled params and we will know some time later.
b) there is no procedure that can change styles after the document is formatted
All style changes processed through ApplyStyleConversion/ApplyParaStyleConversion.
Example:
Code: Select all
procedure TRTInplaceEditor.SetFontSize(const ASize: Integer); //TRTInplaceEditor - Descendant of TRichViewEdit, this is inplace editor of TRichTextParamContent
begin
FFontSize := ASize;
ClearLiveSpellingResults; //It is not necessary also?
ApplyStyleConversion(fcSetFontSize);
end;
and
Code: Select all
procedure TRTInplaceEditor.TextStyleConversion(Sender: TCustomRichViewEdit;
StyleNo, UserData: Integer; AppliedToText: Boolean;
var NewStyleNo: Integer);
var
fi: TFontInfo;
begin
ClearLiveSpellingResults;
fi := TFontInfo.Create(nil);
try
fi.Assign(Style.TextStyles[StyleNo]);
case UserData of
fcSetFontSize: fi.Size := FFontSize;
fcSetFontName: fi.FontName := FFontName;
fcSetFontColor: fi.Color := FFontColor;
fcSetFontStyles: fi.Style := FFontStyles;
end;
NewStyleNo := Style.TextStyles.FindSuchStyle(StyleNo, fi,
RVAllFontInfoProperties);
if NewStyleNo = -1 then
begin
Style.TextStyles.Add;
NewStyleNo := Style.TextStyles.Count - 1;
Style.TextStyles[NewStyleNo].Assign(fi);
Style.TextStyles[NewStyleNo].Standard := False;
Style.TextStyles[NewStyleNo].Charset := RUSSIAN_CHARSET;
end;
finally
fi.Free;
end;
end;