Equivalent to RichEdit DefAttributes

General TRichView support forum. Please post your questions here
Post Reply
Lucian
Posts: 56
Joined: Fri Aug 01, 2014 9:52 am

Equivalent to RichEdit DefAttributes

Post by Lucian »

Hi,

I am creating TRichview component at run time. What is the equivalent of RichEdit.DefAttributes, so that when a user starts editing the component will use, for example, font Tahoma size 12?

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

Post by Sergey Tkachenko »

Do you use RichViewActions?
Do you use StyleTemplates?
Lucian
Posts: 56
Joined: Fri Aug 01, 2014 9:52 am

Post by Lucian »

Sergey Tkachenko wrote:Do you use RichViewActions?
Do you use StyleTemplates?
No and no.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

So, when implementing a New command, you can add a code like this:

Code: Select all

RVStyle1.TextStyles.Clear;
with RVStyle1.TextStyles.Add do begin
  FontName := 'Tahoma';
  Size := 12;
end;
RVStyle1.ParaStyles.Clear;
RVStyle1.ParaStyles.Add; // you can specify default paragraph properties here too
RVStyle1.ListStyles.Clear;
Lucian
Posts: 56
Joined: Fri Aug 01, 2014 9:52 am

Post by Lucian »

Thanks Sergey
Post Reply