Page 1 of 1
Unicode RichViewEdit ScaleRichViewEdit
Posted: Fri Mar 18, 2011 9:28 pm
by TThiel
In RichViewEdit Unicode work fine. but in ScaleRichViewEdit not.
I set
RichViewEdit1.RTFReadProperties.UnicodeMode = rvruOnlyUnicode.
and use the TRVStyle1 from RichViewEdit with
Unicode property = True for all RVStyle1.TextStyles
If I use this a strange behaviour occurs: A correct letter is displayed at the begining of the text and then an undifined letter was written to the right of it and cursor returns to the start of the text.
Posted: Sat Mar 19, 2011 8:00 am
by Sergey Tkachenko
Do you change Unicode property of Styles when the document is already displayed? It is wrong, you need to do it when the editor is completely clear (after calling SRichViewEdit.Clear).
Or use the procedure ConvertRVToUnicode from
http://www.trichview.com/forums/viewtop ... t=70#11569 (from the second message in this topic).
Code: Select all
ConvertRVToUnicode(SRichViewEdit1.RichViewEdit.RVData);
ConvertRVToUnicode(SRichViewEdit1.RVHeader.RVData);
ConvertRVToUnicode(SRichViewEdit1.RVFooter.RVData);
Posted: Sat Mar 19, 2011 3:16 pm
by TThiel
I found the problem.
If I make a clear before loading from stream it works fine:
old not working:
begin
SRichViewEdit1.RichViewEdit.InsertRTFFromStreamEd(TempStr);
end;
new working fine:
begin
SRichViewEdit1.RichViewEdit.Clear;
SRichViewEdit1.RichViewEdit.InsertRTFFromStreamEd(TempStr);
end;
Thanks Sergey you gave me the needed hint.
Posted: Sat Mar 19, 2011 3:24 pm
by Sergey Tkachenko
Hmm..
InsertRTFFromStreamEdi is an editing operation (undoable by the user).
It requires a formatted document, so the correct code is
Code: Select all
SRichViewEdit1.Clear;
SRichViewEdit1.Format;
SRichViewEdit1.RichViewEdit.InsertRTFFromStreamEd(TempStr);
Or, if you do not need an editing operation:
Code: Select all
SRichViewEdit1.Clear;
SRichViewEdit1.RichViewEdit.LoadRTFFromStream(TempStr);
SRichViewEdit1.Format;
Posted: Sat Mar 19, 2011 3:45 pm
by TThiel
OK, this works, too.
Thanks
Posted: Sat Mar 19, 2011 4:06 pm
by Sergey Tkachenko
I corrected the code: changed RichViewEdit.Format to Format.
(TSRichViewEdit.Clear/Format clears/formats not only the main document, but also a header and a footer)