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
| Name | Type | Optional | Default | Descripton |
sText | String | ![]() | The text to show on the menu item | |
oSubMenu | | ![]() | The sub menu that should be opened by the menu item. |
Properties
| Name | Type | get | set | Descripton |
command | | ![]() | The command to execute when the menu item is clicked. | |
enabled | Boolean | ![]() | ![]() | Whether the component is enabled or not. When this is changed the component fires the enabledchanged event. |
html | String | ![]() | ![]() | The html text to show on the menu item |
icon | | ![]() | ![]() | The 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. |
isVisible | Boolean | ![]() | Whether the menu item is shown on the screen | |
mnemonic | String | ![]() | ![]() | A 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). |
nextSibling | | ![]() | Returns the next menu item after the current | |
parent | | ![]() | The menu containing the menu item | |
previousSibling | | ![]() | Returns the previous menu item before the current | |
screenLeft | Number | ![]() | The left position of the MenuItem relative to screen | |
screenTop | Number | ![]() | The top position of the MenuItem relative to screen | |
shortcutText | String | ![]() | ![]() | The 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. |
subMenu | | ![]() | ![]() | The menu that should be opened as a sub menu when the current menu is selected. |
text | String | ![]() | ![]() | The plain text to show on the menu item |
toolTipText | String | ![]() | ![]() | The tool tip text to show when the user hovers the MenuItem. This allows a simple plain text tool tip to be shown. |
topLevelComponent | | ![]() | Returns the top level ancestor component. This is usually the application window hosting the application. | |
visible | Boolean | ![]() | ![]() | Shows or hides the menu item |
Methods
| Name | Description |
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. |
Events
| Name | Type | Bubbles | Descripton |
action | | Fired when the menu item is clicked or invoked using the keyboard | |
enabledchanged | | This 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
| Name | Type | Optional | Default | Descripton |
oDescendant | Object | The BiMenu or BiMenuItem to test whether the current menu item contains it. |
Return Type
Boolean
