Method TrayIcon():onBeforeMenuPopup() Foundation
Popup menu is displayed.
:onBeforeMenuPopup( <oMenu> ) --> self
This method returns self.
A event handler which is called automatically just before a popup menu is displayed. The :onBeforeMenuPopup() handler can be overridden to implement custom behavior in a user-defined class derived from TrayIcon. In particular, the handler can be used to populate the default popup menu with items, or to synchronize the state of existing menu items with the internal state of the application. The following code snippet shows how a "Quit" menu item can be added to the default popup menu.
// Add a "Quit" menu item to the default popup menu the first
// time the menu is opened.
METHOD MyTrayIcon:onBeforeMenuPopup( oMenu )
IF oMenu:numItems() > 0
// Menu is already populated. Ignore.
RETURN self
ENDIF
oMenu:addItem( {"Quit",, PostAppEvent(xbeP_Quit,,,)} )
RETURN self
Note that the popup menu is not displayed if it does not contain any items.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.