Purpose
Adds or removes menus from the menu bar.
Syntax
Alter Menu Bar { Add | Remove }
{ menuname | ID menu_id }
[ , { menuname | ID menu_id } ... ]
menuname is the name of an available menu (e.g., "File")
menu_id is a standard menu ID from one to fifteen; one represents the File menu.
- In MapInfo Pro 64-bit, this command adds or removes a menu from the menu group on the LEGACY tab.
- The following sub-menus would also be treated as individual dropdown in a menu group:
- Open Web Service
- Find Selection
- Oracle Workspace Tools
- Maintenance
- Raster
- Licensing
- Tile Serve Maps
Description
The Alter Menu Bar statement adds or removes one or more menus from the current menu bar.
The menuname parameter is a string representing the name of a menu, such as "File" or "Edit". The menuname parameter may also refer to the name of a custom menu created by a Create Menu statement (see example below)
For a list of MapInfo Pro's standard menu names and their corresponding ID numbers, see Alter Menu statement.
Adding Menus to the Menu Bar
An Alter Menu Bar Add statement adds a menu to the right end of the menu bar. If you need to insert a menu at another position on the menu bar, use the Create Menu Bar statement to redefine the entire menu bar.
If you add enough menus to the menu bar, the menu bar wraps down onto a second line of menu names.
Removing Menus from the Menu Bar
An Alter Menu Bar Remove... statement removes a menu from the menu bar. However, the menu remains part of the "pool" of available menus. Thus, the following pair of statements would first remove the Query menu from the menu bar, and then add the Query menu back onto the menu bar (at the right end of the bar).
Alter Menu Bar Remove "Query"
Alter Menu Bar Add "Query"
After an Alter Menu Bar Remove... statement removes a menu, MapInfo Pro ignores any hotkey sequences corresponding to items that were on the removed menu. For example, a MapInfo Pro user might ordinarily press Ctrl+O to bring up the File menu's Open dialog box; however, if an Alter Menu Bar Remove statement removed the File menu, MapInfo Pro would ignore any Ctrl+O key-presses.
Example
The following example creates a custom menu, called DataEntry, then uses an Alter Menu Bar Add statement to add the DataEntry menu to MapInfo Pro's menu bar.
Declare Sub addsub
Declare Sub editsub
Declare Sub delsub
Create Menu "DataEntry" As
"Add" Calling addsub,
"Edit" Calling editsub,
"Delete" Calling delsub
'Remove the Window menu and Help menu
Alter Menu Bar Remove ID 6, ID 7
'Add the custom menu, then the Window & Help menus
Alter Menu Bar Add "DataEntry", ID 6, ID 7
Before adding the custom menu to the menu bar, this program removes the Help menu (menu ID 7) and the Window menu (ID 6) from the menu bar. The program then adds the custom menu, the Window menu, and the Help menu to the menu bar. This technique guarantees that the last two menus will always be Window and Help.
See Also:
Alter Menu statement, Alter Menu Item statement, Create Menu statement, Create Menu Bar statement, Menu Bar statement