Starting Font and Font size, also show position of cursor

General TRichView support forum. Please post your questions here
Post Reply
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Starting Font and Font size, also show position of cursor

Post by agent86 »

1. When I start the richview font is Arial and font size is 10. How can I set the starting font and font size when opening the form that contains the dbrichview?

2. How can I find the current position of the cursor. I want to display it in the status bar. Iw ant line number and column position.

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

Post by Sergey Tkachenko »

1) Assuming that you use TDBRichViewEdit in mode what allows adding styles, you can use TDBRichViewEdit.OnNewDocument to create a default set of styles:

Code: Select all

// assuming that DBRichViewEdit1.Style = RVStyle1
procedure TForm1.DBRichViewEdit1NewDocument(Sender: TObject);
begin
  RVStyle1.TextStyles.Clear;
  with RVStyle1.TextStyles.Add do begin
    FontName := 'Times New Roman';
    Size := 12;
  end;
  RVStyle.ParaStyles.Clear;
  RVStyle.ParaStyles.Add;
  RVStyle.ListStyles.Clear;
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use GetCurrentLineCol method in OnCaretMove event.
Post Reply