I have a main menu item with two static menu items under it:
mnFavorites
File Edit .... Favorites .....
item 1
item 2
Later I dynamically add menu items to it:
File Edit .... Favorites .....
item 1
item 2
--------------------
item 3
item 4
etc ....
Upon startup, it works great. I get the desired menu. Later I select item
1, which lets me add new items. I end up with double items.
File Edit .... Favorites .....
item 1
item 2
--------------------
item 3
item 4
--------------------
item 3
item 4
item 5
I use the following to delete the items and then later the items get add
back. The delete isn't working because I check the menu's count property it
says it's zero. The count property is correct when the program builds the
menu at startup ( 3 or 4 items).
var
i, iPredCount: integer;
begin
iPredCount := pred(mnFavorites.Count);
if (mnFavorites.Count > 0) then
begin
for i := 2 to iPredCount do
begin
mnFavorites.Delete(2);
end;
end;
....