Page 1 of 1

[RichViewActions] adding items in TRVAPopupMenu

Posted: Wed Dec 16, 2009 5:26 pm
by Sergey Tkachenko
TRVAPopupMenu provides a quick access to the most frequently used actions. It always contains some default set of actions (clipboard, font, paragraph, bullets&numbering, hyperlink) and may be some additional actions (when clicking on a picture or a table).

Items in TRVAPopupMenu are recreated each time before it is displayed. If you want to add a new item, you need to do it in OnPopup event.
This example adds "Paste Special" command below "Paste":

Code: Select all

procedure TForm3.RVAPopupMenu1Popup(Sender: TObject);
var i: Integer;
    mi: TMenuItem;
begin
  for i := 0 to RVAPopupMenu1.Items.Count-1 do
    if RVAPopupMenu1.Items[i].Action is TrvActionPaste then begin
      mi := TMenuItem.Create(RVAPopupMenu1);
      mi.Action := rvActionsResource.rvActionPasteSpecial1;
      RVAPopupMenu1.Items.Insert(i+1, mi);
      break;
    end;
end;