Page 1 of 1

Text display

Posted: Fri Dec 30, 2011 9:51 am
by BennieC
Hi I am struggling to manage the way text is displayed. I have my DB with memos and when an aothor needs to edit these he does so separately using a TRichViewEdit component. The text is displayed properly here. However, when a Reader views the data it is concatenated (using AppendFrom) into a single TRichview component with titles in between. The concatenated text is displayed as white with a red background and I cannot get rid of it, in spite of changing all text as follows.

Code: Select all

      for i := 0 to aRV.Style.TextStyles.Count - 1 do
      begin
        aRV.Style.TextStyles[i].FontName := 'Arial';
        aRV.Style.TextStyles[i].Size := 10;
        aRV.Style.TextStyles[i].Color := clBlack;
        aRV.Style.TextStyles[i].BackColor := clWhite;
      end;
The headers do change but not the text.
Regards

Posted: Fri Dec 30, 2011 2:22 pm
by Sergey Tkachenko
White-on-read text means incorrect references to text styles (StyleNo<0 for a text item, or StyleNo>=Style.TextStyles.Count).

Can you reproduce this problem in a simple project?

Posted: Mon Jan 02, 2012 8:10 am
by BennieC
Hi, Sorry for the delay. I have managed to create a sample where I read memos from a file instead of the DB. It does illustrate the problem. I have attached all the sample text in the demo but need an e-mail address to send the file. (it's not very big about 300k)
Regards

Posted: Mon Jan 02, 2012 1:52 pm
by Sergey Tkachenko
Send to richviewgmailcom

Posted: Tue Jan 03, 2012 4:43 pm
by Sergey Tkachenko
I received it.
Do not use AppendFrom for copying between richviews linked to different TRVStyle components. Use a stream (SaveRVFToStream and InsertRVFFromStream). I send modified code by email.

Posted: Tue Jan 03, 2012 6:23 pm
by BennieC
Thanks Sergey, worked like a charm.
Is there anywhere I can get an overview of TRichview. I do not want to be an expert but apparently need a little more insight into its workings.
regards.

Posted: Tue Jan 03, 2012 6:28 pm
by Sergey Tkachenko