411 REFERENCE · Wikibooks
Futurebasic/Language/Reference/on menu
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
ON MENU
Statement
(+)
Appearance
(+)
Standard
<td width="16">
Console
Syntax
ON MENU {FN userFunction|GOSUB{lineNumber|"stmtLabel"}}
Description
This statement designates a particular function or subroutine as a menu-event handling routine. A menu-event handling routine is called in response to the user selecting an item from a menu. This includes menu items that your program puts into menus on the menu bar, but it doesn't include items in pop-up menus; see the MENU function for more information.
When the user clicks on the menu bar, FB does not open up the menu immediately. Instead, your program continues executing until a HANDLEVENTS statement is reached. If the mouse button is still down at that time, HANDLEEVENTS then opens the menu, tracks the user's selection, then calls your menu-event handling routine if the user selected a menu item. Your routine should examine the MENU(_menuID) and MENU(_itemID) functions to get information about the event.
Note:
If you use the ON MENU FN userFunction syntax, then userFunction must refer to a function which was defined or prototyped at an earlier location in the source code. Your menu-event handling function should not take any parameters, nor return a result.
See Also
HANDLEEVENTS; MENU function