TsrvActionCustomLayout.OnExecuted

<< Click to display table of contents >>

TsrvActionCustomLayout.OnExecuted

Occurs after the action applies the layout

property OnExecuted: TNotifyEvent;

This event may be useful if you have buttons for document view modes in the scrollbar area of TSRichViewEdit control.

You can use this event to synchronize buttons with the actions.

Example:

(assuming that the buttons are in the following order: draft, web layout, print layout)

// SRichViewEdit1.OnHMenuClickButton

procedure TfrmMain.SRichViewEdit1HMenuClickButton(Sender: TObject;

  ToolButton: TSRVToolButton);

begin

  if ToolButton = nil then Exit;

  SRichViewEdit1.CanUpdate := False;

  case (ToolButton.Index) of

    0 : srvActionLayoutDraft1.Execute;

    1 : srvActionLayoutWeb1.Execute;

    2 : srvActionLayoutPrint1.Execute;

    3 : srvActionLayoutSideToSide1.Execute;

    4 : srvActionLayoutRead1.Execute;

  end;

  ActiveEditor.CanUpdate := True;

end;

// After doc view actions are executed

// TsrvActionLayoutDraft

procedure TfrmMain.srvActionLayoutDraft1Executed(Sender: TObject);

begin

  TSRVToolButton(SRichViewEdit1.MenuHButtons.Items[0]).Down := 

    True;

end;

// TsrvActionLayoutWeb

procedure TfrmMain.srvActionLayoutWeb1Executed(Sender: TObject);

begin

  TSRVToolButton(SRichViewEdit1.MenuHButtons.Items[1]).Down :=

    True;

end;

// TsrvActionLayoutPrint

procedure TfrmMain.srvActionLayoutPrint1Executed(Sender: TObject);

begin

  TSRVToolButton(SRichViewEdit1.MenuHButtons.Items[2]).Down :=

    True;

end;