FutureBasic Logo

<<    Index    >> FutureBasic 5

on menu   statement



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, FutureBasic 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