Page 1 of 1

Equivalent to RichEdit DefAttributes

Posted: Tue Oct 28, 2014 11:21 am
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

Posted: Tue Oct 28, 2014 1:14 pm
by Sergey Tkachenko
Do you use RichViewActions?
Do you use StyleTemplates?

Posted: Tue Oct 28, 2014 2:44 pm
by Lucian
Sergey Tkachenko wrote:Do you use RichViewActions?
Do you use StyleTemplates?
No and no.

Posted: Tue Oct 28, 2014 3:13 pm
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;

Posted: Wed Oct 29, 2014 8:59 am
by Lucian
Thanks Sergey