setEventMapping
setEventMapping(eventName: String; mappedName: String);
The setEventMapping method of the MenuItem class enables the method that is to be executed for an event to be dynamically set at run time. (See also the
This method is equivalent to the setEventMappingEx method but it is less efficient, as it must find the methods by name. You should therefore use the setEventMappingEx method to improve performance.
An exception is raised if a MenuItem method is invoked from a server method.
By default, the JADE development environment allows the definition of event methods (menu-name_event-name) for a menu; for example:
mTickerTimer_click(menuItem: MenuItem input) updating;
The parameters of the setEventMapping method are listed in the following table.
Setting | Description |
---|---|
eventName | Must be a defined event name for the menu; for example, click. |
mappedName | The name of the method that is to be called. This method must exist on the form that is the parent of the menu or window for which you are calling the setEventMapping method. |
The code fragment in the following example shows the use of the setEventMapping method.
mTickerTimer.setEventMapping("click", "myOtherMenu");
The method checks that:
-
The event method is valid for the menu
-
The method to be called exists
-
The signature of the method matches the event method signature