property dbPopupMenu: TPopupMenu
Description
Provides access to the component's popup menu.
Allows you to configure the popup menu.
Examples
// hide menu item
Form1.TreeView1.dbPopupMenu.Items[0].Visible := False;
// disable menu item
Form1.TreeView1.dbPopupMenu.Items[0].Enabled := False;
// programmatically click on the first menu item (numbering starts from 0)
Form1.TreeView1.dbPopupMenu.Items[0].Click;
// renaming menu items
procedure Form1_OnShow (Sender: TObject; Action: string);
begin
Form1.TreeView1.dbPopupMenu.Items[0].Caption := 'Show record 2';
Form1.TreeView1.dbPopupMenu.Items[1].Caption := 'Delete record 2';
Form1.TreeView1.dbPopupMenu.Items[3].Caption := 'Copy cell 2';
Form1.TreeView1.dbPopupMenu.Items[4].Caption := 'Copy 2';
Form1.TreeView1.dbPopupMenu.Items[5].Caption := 'Copy all 2';
Form1.TreeView1.dbPopupMenu.Items[7].Caption := 'Find 2';
end;
// adding menu items and submenu
procedure Form1_OnShow (Sender: TObject; Action: string);
var
SubMenu: TMenuItem;
MenuItem: TMenuItem;
begin
SubMenu := TMenuItem.Create (Form1);
SubMenu.Caption := 'SubMenu';
MenuItem := TMenuItem.Create (Form1);
MenuItem.Caption := 'Item';
MenuItem.OnClick := @MenuClick1;
Form1.TreeView1.dbPopupMenu.Items.Insert(0, SubMenu);
Form1.TreeView1.dbPopupMenu.Items[0].Add(MenuItem);
end;
procedure MenuClick1;
begin
ShowMessage('Hello from PopupMenu');
end;