TrvActionNew.OnNew

Top  Previous  Next

Occurs when the action is executed.

property OnNew: TNotifyEvent;

This event occurs after the document is cleared.

This event is called both by TrvActionNew and TrvActionOpen (inherited from TrvActionNew). For the latter, this event is called before the loading occurs. Because of this, you should assign the event handler for the both these actions.

This is a good place to define default values for collections of styles. For example:

procedure TForm1.rvActionNew1New(Sender: TObject);

begin

  RVStyle1.ParaStyles.Clear;

  RVStyle1.ParaStyles.Add; // one default paragraph style

 

  RVStyle1.ListStyles.Clear; // no default list styles

 

  RVStyle1.TextStyles.Clear;

  with RVStyle1.TextStyles.Add do begin // one default text style

    FontName := 'Times New Roman';

    Size     := 12;

  end;

end;


RichView © Sergey Tkachenko