onPopupEvents([callback], [remove])
Class: Menu.
Description:
Registers, unregisters and gets a list of handler functions for the menu popup events (when the menu becomes expended and collapsed).
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
function |
Event handler function that receives a PopupEvent as an argument. Pass |
|
|
boolean |
Set to |
Returns:
Returns an array of registered handler functions if arguments are omitted, otherwise returns this component instance.
Type: Array.<function()> | ComboBox
Examples:
mainForm.mainMenuBar = new MenuBar();
let handler = function(e){console.log(e);}
mainForm.fileMenu = new Menu("File").addTo(mainForm.mainMenuBar).onPopupEvents(handler);
// event Object format:
const e = {
target: object, // The component that triggered the event.
type: string, // `show`, `hide`, `cancel`.
invoker: Object // UI Component that invoked the popup, or `null` if it was invoked programmatically.
x: number, // X position relative to invoker. Only present when invoker is not `null`.
y: number, // Y position relative to invoker. Only present when invoker is not `null`.
screenX: number, // X position relative to default screen.
screenY: number, // Y position relative to default screen.
interactive: boolean, // Indicates if the popup was triggered by user's interaction (not programmatically).
};
