Link to home
Start Free TrialLog in
Avatar of zebada
zebada

asked on

How to copy a menu in IDE

I have an old form that has a TPopupMenu on it.
I have created a new form to which I need to copy the TPopupMenu.

I selected the TPopupMenu on the old form, Pressed Ctrl-C clicked on the new form and pressed Ctrl-V. The TPopupMenu appeared in the new form - ok so far.

Now here's the problem:

No matter how I try to assign methods in the new form to the OnClick event of the TPopupMenu's menu items I cannot get the events to actually fire. I.e. the code in the methods attached to the events is never executed.

If I add a new menu item then I can configrre the OnClicked event for that new item no problem. If I delete an existing menu item and re-add it I can configure the OnClicked event no problem - I just cannot configure the OnClicked event for menuitems that were copied along with the TPopupMenu.

I have compared the .dfm files for both the new and old forms and I can't see any difference in the definitions for the TPopupMenu or the menu items.

What have I done wrong - should I be able to copy TPopupMenus in this manner?

Regards
Paul
ASKER CERTIFIED SOLUTION
Avatar of shibin78
shibin78

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zebada
zebada

ASKER

I tried a few small example programs and like you say, they seem to work OK.

I guess it must be something wierd I am doing in my application. I will try to hunt it down and post a more detailed/accurate description of what/why it doesn't seem to work.

Regards
Paul
Avatar of zebada

ASKER

I can't reproduce the problem now.
You're right it seems to work fine.

Thanks for taking the time to reply :)