Page 1 of 1

Starting Font and Font size, also show position of cursor

Posted: Wed Jan 12, 2011 3:45 am
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

Posted: Wed Jan 12, 2011 7:00 pm
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;

Posted: Wed Jan 12, 2011 7:01 pm
by Sergey Tkachenko
Use GetCurrentLineCol method in OnCaretMove event.