Futurebasic/Language/Reference/menu resource

edit

Syntax

edit

MENU resID%,{_resMenu|_resSubMenu},state [,resType$]

Description

edit

Use this form of the MENU statement to install a menu which is described in a "MENU" resource. The menu's items can either be defined in the "MENU" resource, or they can consist of a list of available named resources of a particular type (such as font resources).

The resID% parameter should specify the resource ID number of a "MENU" resource in a currently open resource file (usually in your application's resource fork). In most cases, this will also equal the menu's ID number (although the menu's ID number is actually defined within the "MENU" resource).

If you specify _resMenu, the menu will be installed on the menu bar. In this case, you should use a menu with a menu ID number in the range 1 through 31, which is different from the ID number of any existing menu.

If you specify _resSubMenu, the menu won't be installed on the menu bar, but will be added to an internal "menu list." Use this option when you want to install the menu as a hierarchical menu or a pop-up menu. To install a hierarchical resource menu, you must also use the Toolbox procedure InsertMenu. The following illustrates how this may be done:

resID% = 130 menuID% = 130 'Put resource menu on internal "menu list": MENU resID%, _resSubMenu, _enable 'Set this menu's "parent item": MENU parentMenuID,parentItemID,menuID%,title$+"/"+CHR$(&1B) 'Attach the resource sub-menu to the parent menu: CALL INSERTMENU(FN GETMENUHANDLE(menuID%), -1)

If you use the _resSubMenu option, you should use a menu with a menu ID number in the range 32 through 235, which is different from the ID number of any existing menu.

The state parameter specifies whether the menu should initially be enabled or disabled (dimmed). Set this parameter either to _enable (1) or to _disable (0).

If you omit the resType$ parameter, the resource menu's title and menu items will be displayed as defined in the "MENU" resource. If you specify the resType$ parameter, it should be a 4-character string indicating a resource type. In this case, the menu's items will consist of a list of all available named resources of the indicated type. For example, if you specify a resType$ value of "FOND", the menu will list the names of all available fonts. The menu's title is still taken from the "MENU" resource.

Note: You can use a program like ResEdit to create "MENU" resources.

See Also

edit

MENU statement; MENU function