Jump to content

Futurebasic/Language/Reference/on menu

From Wikibooks, open books for an open world

ON MENU

[edit | edit source]

Statement

[edit | edit source]
(+) Appearance (+) Standard Console

Syntax

[edit | edit source]

ON MENU {FN userFunction|GOSUB{lineNumber|"stmtLabel"}}

Description

[edit | edit source]

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 <a href="menu%20function.html">MENU</a> 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

[edit | edit source]

HANDLEEVENTS; MENU function