I am trying to make all changes to the MainMenu object of the wpDefACtion7 modifying it from my own routines, to avoid to spend several hours each time WPTools changes version.
To adapt the standard MainMenu to my program, I need to delete some items, and change the level of some other.
In that case, I can not get the changes working. What, I am trying to delete the menu "Delete" and their subitems from the "Edit" main menu, and then pass the "Del" subitem to depend directly from the "Edit" main menu.
Code for finding and delete items is working, and also the inserted menu is apearing, but nothing happens when I clic into the inserted "Del" menu.
This is the code I am using:
Code
var
mWPDefaultActions: TWPDefAct;
iK: SmallInt;
mnu: TMenuItem;
begin
mWPDefaultActions := TWPDefAct.Create(Self);
Menu := mWPDefaultActions.MainMenu;
// Find "Edit" menu
for iK := 0 to Menu.Items.Count-1 do
begin
if SameText(Menu.Items[iK].Caption, '&Edit') then
begin
mnu := Menu.Items[iK];
break;
end;
end;
// Delete "Delete1" item from "Edit" menu
for iK := 0 to mnu.Count-1 do
begin
if SameText(mnu.Items[iK].Name, 'Delete1') then
begin
mnu.Delete(iK);
break;
end;
end;
// Add standard "Del" action menu (ext1) is the name of the "Del" menu
mnu.Add(mWPDefaultActions.ext1);
Alles anzeigen
How can I make the last mnu.Add code to work ?