Page 1 of 1
Style woes
Posted: Tue Sep 29, 2015 8:06 am
by shoebuddy
I don't understand what I'm doing wrong. I have set my RVStyle single item to have the font Times New Roman size 12. But every time I start a new note: the style is calibri 11?????
How to I initiate the editor so every note starts out Times New Roman 12?
Posted: Tue Sep 29, 2015 1:39 pm
by Sergey Tkachenko
How do you start a new note?
Do you use RichViewActions?
Do you use StyleTemplates (is rve.UseStyleTemplates True of False)
Posted: Mon Oct 05, 2015 10:08 am
by shoebuddy
I'm using a db version and solved the problem by not using a template
Posted: Mon Oct 05, 2015 10:09 am
by shoebuddy
I set it to false.
Posted: Mon Oct 05, 2015 10:35 am
by Sergey Tkachenko
Actually, in all cases, the default font is defined in RVStyle.TextStyles[0].
When using StyleTemplates, the proper way for implementing New command includes resetting properties of RVStyle.TextStyles[0] to values defined in "Normal" style template. TrvActionNew does it automatically. Without RichViewActions, implementation is shown in Demos\DelphiUnicode\Editors\StyleTemplates\
But even if you do not use StyleTemplates, it's normally not enough to define properties of RVStyle.TextStyles[0] one time. Your editor can load RVF documents (from DB or file), and collections of styles will be replaced.
For TDBRichViewEdit, you can set default text style in OnNewDocument event:
Code: Select all
procedure TForm1.DBRichViewEdit1NewDocument(Sender: TObject);
var RVStyle: TRVStyle;
begin
RVStyle := (Sender as TCustomRichView).Style;
RVStyle.TextStyles.Clear;
RVStyle.ParaStyles.Clear;
RVStyle.ListStyles.Clear;
with RVStyle.TextStyles.Add do
begin
FontName := 'Times New Roman';
Size := 12;
end;
RVStyle.ParaStyles.Add;
end;
Posted: Mon Oct 05, 2015 7:32 pm
by shoebuddy
Thanks!