Constructing a new contextual menu

Hi all,

I am constructing a contextual menu, so whenever a user right-click an object on a form, then a contextual menu is shown with the actions for that control.

I have constructed a contextual menu for the form itself.

I have two other controls on that form. In each ConstructContextualMenu handler I add menu items specifically for that control.

while right clicking the form, the contextual menu is correct. However when right clicking one of those controls, then on top are the menu items shown for that item, but under them, the menu items for the form.

I searched the Language reference but cannot find anything to start with a fresh contextual menu each time one of those controls is right clicked.

Can you tell me how to start with an empty contextual menu whenever the user right click a control?

Thank you very much for your help.

Friendly greetings,


Are you returning True in the ConstructContextualMenu event?

Thank you very much Eli,

I was not returning True, so I changed the code in both controls and it does not exactly as intended.

Your reply which is very much appreciated solved my problem.

Have a very nice day.

Friendly greetings,