How to change properties for hidden text?

General TRichView support forum. Please post your questions here
Post Reply
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

How to change properties for hidden text?

Post by Jim Knopf »

Hi, me again

how can I change the outfit of hidden text? Without dotted underline instead of this color gray.
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, dotted underlined are hard-coded
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

and text color?
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Color can be changed in OnApplyStyleColor event
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

Can you give me a hint how?

- RVEdit: Settings are 'use predefined set of styles' (necessary to protect of importet formatting)
- style No 15 in TRVStyle has options = rvteoHidden

It works but would be fine to recognize hidden text immediately as such one.
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I understand your settings but I do not understand the question.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

sorry for poor explanation.

If I change text color of style 15 I can apply dark colors as clNavy or clGreen but no lighter ones, clSilver e.g.

And I don't know how to change color of hidden text by OnApplyStyleColor event.
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

First, I do not understand why do you need some special code or settings for hidden text, if you only have a single text style used for hidden text.
Just assign RVStyle.TextStyles[15].Color := clNavy to change its text.

OnApplyStyleColor can be used if you want to display some text with different colors, not with colors specified in Color or BackColor properties.

Something like:

Code: Select all

procedure TMyForm.MyRVStyleApplyStyleColor(Sender: TRVStyle; Canvas: TCanvas;
  StyleNo: Integer; DrawState: TRVTextDrawStates; var DoDefault: Boolean);
begin
  if (rvteoHidden in Sender.TextStyles[StyleNo].Options) and 
    not (rvtsSelected in DrawState) then begin
    Canvas.Font.Color := clNavy;
    Canvas.Brush.Style := bsClear;
    DoDefault := False;
  end;
end;
This code makes all hidden text color = clNavy.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

The reason why I tried out an other way is, that I can't change RVStyle.TextStyles[15].Color. I can, sure, but it has no effect. May be because of I use 'use a predefined set of styles' in my rvEdit.

So I assume that the editor is searching a style as similar as possible if I assign 'hidden' to a selected text and creates a new one if it dont' find one. If the color of RVStyle.TextStyles[15] is dark (clNavy, clGreen) perhaps it is 'enough similar' and it accepts the existing style. E.g. gray or silver is not similar > makes its own new style. I hope I could explain my problem? Sorry I know it sounds a little complicated ...
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

But the code you posted under MyRVStyleApplyStyleColor works fine, thank you so much!
lkessler
Posts: 112
Joined: Thu Sep 01, 2005 9:00 pm
Location: Winnipeg, Manitoba, Canada
Contact:

Post by lkessler »

I too would like the option to display hidden text without the dotted underline.

Louis
Post Reply