How To Set A TRVEdit's Font To Something Other Than 0?

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

How To Set A TRVEdit's Font To Something Other Than 0?

Post by DickBryant »

I am using a single RVStyle control for all of my RVEdits so that I can use the workaround of storing auto-added styles in cells in a table. Each RVEdit is responsible for one of the columns of cells in the table and each must be able to add font styles on the fly and then store the resulting RVData back into the table. This part is working OK.

The RVStyle control has two fonts in it to start 0 and 1. Most of the RVEdits can use 0 as their default font, but I need some of the RVEdits to use 1 as THEIR default font. How can I do this?
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

I think I've solved this one myself. In the OnEnter event do

procedure TFEditor.EMC1Enter(Sender: TObject);
begin
with Sender as TRichViewEdit do
begin
if RVData.GetItemTextW(0) = '' then
CurTextStyleNo := 1;
end;
end;

Seems to do what I need.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Each editor initially has one empty text string (if the editor is clear, it is added on formatting).
So the best way is to create an empty string of the proper style (on clearing):

Code: Select all

rve.Clear;
rve.AddNLATag('', 1, 0, 0);
rve.Format;
Post Reply