Text display

General TRichView support forum. Please post your questions here
Post Reply
BennieC
Posts: 28
Joined: Sat Jun 18, 2011 7:00 pm

Text display

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

Post 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?
BennieC
Posts: 28
Joined: Sat Jun 18, 2011 7:00 pm

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

Post by Sergey Tkachenko »

Send to richviewgmailcom
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
BennieC
Posts: 28
Joined: Sat Jun 18, 2011 7:00 pm

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