BiMenuItem

Represents a menu item for a menu.

This class extends BiEventTarget and therefore all methods and fields available for BiEventTarget are also available for BiMenuItem .

Constructor

new BiMenuItem ( [ sText [ ,oSubMenu ] ] )

Parameters

NameTypeOptionalDefaultDescripton
sTextStringcheckedThe text to show on the menu item
oSubMenuBiMenucheckedThe sub menu that should be opened by the menu item.

Properties

NameTypegetsetDescripton
commandBiCommandcheckedThe command to execute when the menu item is clicked.
enabledBooleancheckedcheckedWhether the component is enabled or not. When this is changed the component fires the enabledchanged event.
htmlStringcheckedcheckedThe html text to show on the menu item
iconBiImagecheckedcheckedThe icon image to show on the menu item. Note that changing the image object does not update the label icon. You'll have to set the icon property to update the label icon. The size of the icon of the menu item is currently fixed.
isVisibleBooleancheckedWhether the menu item is shown on the screen
mnemonicStringcheckedcheckedA character used to give UI hints about the access key for the menu label. The mnemonic will always be a single, lower-case character (converted if necessary).
nextSiblingBiMenuItemcheckedReturns the next menu item after the current
parentBiMenucheckedThe menu containing the menu item
previousSiblingBiMenuItemcheckedReturns the previous menu item before the current
screenLeftNumbercheckedThe left position of the MenuItem relative to screen
screenTopNumbercheckedThe top position of the MenuItem relative to screen
shortcutTextStringcheckedcheckedThe shortcut text is shown on the menu to give the user a hint about keyboard shortcuts. Setting this on the menu just adds the text. It does not set up the keyboard shortcut.
subMenuBiMenucheckedcheckedThe menu that should be opened as a sub menu when the current menu is selected.
textStringcheckedcheckedThe plain text to show on the menu item
toolTipTextStringcheckedcheckedThe tool tip text to show when the user hovers the MenuItem. This allows a simple plain text tool tip to be shown.
topLevelComponentBiComponentcheckedReturns the top level ancestor component. This is usually the application window hosting the application.
visibleBooleancheckedcheckedShows or hides the menu item

Methods

NameDescription
containsReturns true if the menu item contains another menu item or menu. This means that the current component is an ancestor of the descendant. Note that the current component contains itself so calling component.contains(component) will return true.

A menu item is considered parent of its sub menu and will therefore contain the sub menu.

Events

NameTypeBubblesDescripton
actionBiEventFired when the menu item is clicked or invoked using the keyboard
enabledchangedBiEventThis is fired when the enabled property is changed

Static Methods

None.

Static Fields

None.

Remarks

The size of the icon for the menu item is fixed to 16x16. If the menu item has a command the command will be executed when the user clicks the item. The shortcutText property is synchronized with the command shortcut.

Method Details

contains

Returns true if the menu item contains another menu item or menu. This means that the current component is an ancestor of the descendant. Note that the current component contains itself so calling component.contains(component) will return true.

A menu item is considered parent of its sub menu and will therefore contain the sub menu.

Syntax

object.contains ( oDescendant )

Parameters

NameTypeOptionalDefaultDescripton
oDescendantObjectThe BiMenu or BiMenuItem to test whether the current menu item contains it.

Return Type

Boolean