[RichViewActions] adding items in TRVAPopupMenu

Demos, code samples. Only questions related to the existing topics are allowed here.
Post Reply
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[RichViewActions] adding items in TRVAPopupMenu

Post 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;
Post Reply