Register click on a menuitem


Hi again.

I'm circling back to this issue, since I really want to make this work.
As previously mentioned, the pbm_menuselect event fires every time the user moves the pointer over an menuitem.
And that doesn't make any sense in my case. There is also no way to filter out if the user moves over og clicks a menuitem.

Is there any other event that I can implement to register only the click on a specific menuitem?
Or is the solution as cumbersome as to make a function on the main menu which records the clicks and call it on each menuitem's clicked() event?

Perhaps some of the Appeon engineers or SAP MVP's have another take on this issue?


Hopefully awaiting answers.

Bjarne Anker

Question Tags: 


Roland Smith answered Register click on a menuitem


I have a solution which doesn't need any Windows API functions or special event code.

First create a menu object called 'm_menuitem' with one menu item. After saving the object, delete the menu item and save the menu object again. Close the menu painter.

Open the menu object used by the main app window in Edit Source mode. Replace 'from menu within' with 'from m_menuitem within'. Save the object and close the source editor.

Now all the menu items in your main menu inherit from m_menuitem. Add code to the clicked event of m_menuitem to record the clicks. If you want to have the recording code in the window, you can call a window function like this:

ParentWindow.Dynamic Function wf_menuclicked(this.ClassName())