Unicode RichViewEdit ScaleRichViewEdit

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
TThiel
Posts: 6
Joined: Fri Mar 18, 2011 9:19 pm

Unicode RichViewEdit ScaleRichViewEdit

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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);
TThiel
Posts: 6
Joined: Fri Mar 18, 2011 9:19 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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; 
Last edited by Sergey Tkachenko on Sat Mar 19, 2011 4:05 pm, edited 1 time in total.
TThiel
Posts: 6
Joined: Fri Mar 18, 2011 9:19 pm

Post by TThiel »

OK, this works, too.

Thanks
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

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