Adding User-defined Event Methods to a Menu Item

You can add user‑defined event methods for menu items, to handle populating or refreshing the state of each in a recursive manner in a similar way that you can controls. (See "Adding Methods to Your Subclassed Control", in Chapter 5 of the JADE Developer's Reference".) In earlier releases, only the click and select events were available.

Menu items have the following method types.

Event methods are methods that are usually triggered by an event.

Event methods execute the logic in the method and then call a method (whose method name is specified by the menu-name_this-method-name signature) of the form on which the menu is placed.

When you reimplement an event method, include the inheritMethod instruction call.

You must add event methods as external methods.

To add a custom menu item event method, add an external method to the MenuItem class as follows:

event-name(parameter-list) is CallMenuEvent in jadpmap updating;

After you have defined the custom menu item, clicking on a menu item property of a form will include that menu item name in the menu item event list that is displayed.

You can then define the event logic. To take effect, this event must be called manually in logic; for example:

mnuAddCustomer.event-name();

If the menu item is deleted, the associated event methods (including any custom events) are also deleted.

At run time, it is this call that causes a form message to be generated. Methods are event methods only if the highest level of method implementation has a signature with this format.

If you reimplement these methods, ensure that you include an inheritMethod call. For example, if you add a method named initialize to the MenuItem class, calling inheritMethod will result in menu_itemname_initialize being called. When you add an event to your menu item, JADE does nothing to that event unless you write code to implement it.

2020.0.02 and higher