Developer Resources

MenuBar

Overview

The MenuBar class represents a menu bar.

Constructor

MenuBar()

Methods

MenuBar.add
Adds a menu to a menu bar.
MenuBar.findMenu
Finds the location of a menu in the menu bar.
MenuBar.getMenu
Returns a menu in the menu bar.
MenuBar.getMenuCount
Returns the number of menus in the menu bar.
MenuBar.getMenuItems
Returns an array of menus and menu items that are in the menu.
MenuBar.getMenus
Returns an array of menus that are in the menu bar.
MenuBar.insert
Inserts a menu into a menu bar.
MenuBar.remove
Removes a menu from the menu bar.

MenuBar.add

function MenuBar.add(item : Menu)

Arguments

item
The menu to add to the menu bar.

Description

Adds a menu bar specified by item to the menu.

MenuBar.findMenu

function MenuBar.findMenu(caption : String) : Integer

Arguments

caption
The text of the menu to find.

Returns

The zero-based index of the menu with a particular caption or -1 if a menu with a caption does not exist.

Description

Finds the location of a menu with a particular caption in the menu bar and returns the location where the menu is located. If a menu with the caption is not found, then the function returns -1.

MenuBar.getMenu

function MenuBar.getMenu(index : Integer) : Menu

Returns

The menu at the specified zero-based index in the menu bar. If index is less than 0, greater than the number of menus in the menu bar or is unspecified, the function returns null.

Description

Returns the menu in the menu bar at the specified index.

MenuBar.getMenuCount

function MenuBar.getMenuCount() : Integer

Returns

The number of menus in the menu bar.

Description

Returns the number of menus in the menu bar.

MenuBar.getMenuItems

function MenuBar.getMenuItems() : Array(Menu/MenuItem)

Returns

An array of menus and menu items that are in the menu.

Description

Returns an array of menus and menu items that are in the menu.

MenuBar.getMenus

function MenuBar.getMenus() : Array(Menu)

Returns

An array of menus that are in the menu bar.

Description

Returns an array of menus that are in the menu bar.

MenuBar.insert

function MenuBar.insert(item : Menu, index : Integer)

Arguments

item
The menu to insert into the menu bar.
index
The location where item is inserted.

Description

Inserts a menu specified by item into the menu bar at a given index. If no index is specified, the menu or menu item is inserted at the end of the menu.

MenuBar.remove

function MenuBar.remove(item : Menu) : Boolean
function MenuBar.remove(index : Integer) : Boolean

Returns

Returns true if the menu is removed, and false otherwise.

Description

Removes a menu from the menu bar that is explicitly denoted by item or else by an position given by index. The function returns true if the menu is removed, false otherwise.