TrvActionCustomNew.OnNew

<< Click to display table of contents >>

TrvActionCustomNew.OnNew

Occurs when the action is executed.

property OnNew: TNotifyEvent;

This event occurs after the document is cleared.

This event is called by TrvActionNew.

TrvActionOpen has this event as well, it may be called before the loading occurs. However, it calls this event only if it is not linked (either explicitly or implicitly) with TrvActionNew. If linked, TrvActionOpen calls the event of TrvActionNew instead.

If style templates are not used, 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;

If style templates are used, styles are reset automatically.