The class that represents a menu.
new Menu()
Name | Description |
None. |
Name | Type | Descripton |
keyboardAccelKey | Number | The keyCode for the key that is used to activate the menubar |
keyboardAccelProperty | String | The preoperty name for the property of the event object used in keyboard related events that when true should disable the defautl action |
Name | Description | |||||||||||||||
addSyntax
Arguments
Return Type
| Adds a menu item last to the menu | |||||||||||||||
areSizesCachedSyntax
ArgumentsNo Arguments. Return Type
| Returns whether the sizes are cached | |||||||||||||||
cacheSizesSyntax
Arguments
Return Type
| Depreciated. Use updateSizeCache and/or resetSizeCache instead. Used to recalculate the sizes and cache them for future use | |||||||||||||||
closeSyntax
ArgumentsNo Arguments. Return Type
| Closes the menu | |||||||||||||||
closeAllMenusSyntax
ArgumentsNo Arguments. Return Type
| Closes all menus in the menu tree | |||||||||||||||
closeAllSubsSyntax
Arguments
Return Type
| Closes all the sub menus except the provided one. If no argument is passed all subs are closed. | |||||||||||||||
createPopupSyntax
ArgumentsNo Arguments. Return Type
| Creates the popup object used for the menu | |||||||||||||||
drawMenuSyntax
ArgumentsNo Arguments. Return Type
| Draws the menu inside the popup object. This function does nothing if the menu is not invalidated | |||||||||||||||
fixScrollButtonsSyntax
ArgumentsNo Arguments. Return Type
| Fixes the visibility of the scroll buttons | |||||||||||||||
fixScrollEnabledStateSyntax
ArgumentsNo Arguments. Return Type
| If the scroll buttons are showed this enables and disables the buttons depending on the current scroll position | |||||||||||||||
fixSizeSyntax
ArgumentsNo Arguments. Return Type
| Resizes the menu to fit its content | |||||||||||||||
getDocumentSyntax
ArgumentsNo Arguments. Return Type
| Returns the document inside the popup used for the menu | |||||||||||||||
getHeightSyntax
ArgumentsNo Arguments. Return Type
| Returns the height of the menu | |||||||||||||||
getInsetBottomSyntax
ArgumentsNo Arguments. Return Type
| Returns the distance between the lower outer edge of the menu and the last menu item | |||||||||||||||
getInsetLeftSyntax
ArgumentsNo Arguments. Return Type
| Returns the distance between the outer left edge of the menu and the menu items | |||||||||||||||
getInsetRightSyntax
ArgumentsNo Arguments. Return Type
| Returns the distance between the right outer edge of the menu and the menu items | |||||||||||||||
getInsetTopSyntax
ArgumentsNo Arguments. Return Type
| Returns the distance between the outer upper edge of the menu and the first menu item | |||||||||||||||
getLeftSyntax
ArgumentsNo Arguments. Return Type
| Returns the left position of the menu | |||||||||||||||
getMeasureDocumentSyntax
ArgumentsNo Arguments. Return Type
| Returns a document that can be used to measure the content inside the menu | |||||||||||||||
getMenuBarSyntax
ArgumentsNo Arguments. Return Type
| Returns the first parent menu that is an instance of the class MenuBar | |||||||||||||||
getPreferredHeightSyntax
ArgumentsNo Arguments. Return Type
| Returns the preferred height of the menu. This is the sum of all items and assuming that no scroll buttons are needed | |||||||||||||||
getPreferredWidthSyntax
ArgumentsNo Arguments. Return Type
| Returns the preferred width of the menu. This is the width of the widest menu item. | |||||||||||||||
getSelectedIndexSyntax
ArgumentsNo Arguments. Return Type
| Returns the index of the selected menu item | |||||||||||||||
getTopSyntax
ArgumentsNo Arguments. Return Type
| Returns the top position of the menu | |||||||||||||||
getWidthSyntax
ArgumentsNo Arguments. Return Type
| Returns the width of the menu | |||||||||||||||
goToNextMenuSyntax
ArgumentsNo Arguments. Return Type
| Goes to the next menu. If the currently selected menu item has a sub menu then this is selected. If not the next menu button on the menu bar is selected. | |||||||||||||||
goToNextMenuItemSyntax
ArgumentsNo Arguments. Return Type
| Selects the next menu item in the menu. If the last item was selected the first one becomes selected. Notice that menu separators are skipped. | |||||||||||||||
goToPreviousMenuSyntax
ArgumentsNo Arguments. Return Type
| Goes to the previous menu. If the current menu has a parent menu then this menu is closed. If not then the previous menu button on the menu bar is selected. | |||||||||||||||
goToPreviousMenuItemSyntax
ArgumentsNo Arguments. Return Type
| Selects the previous menu item in the menu. If the first item is selected the last one becomes selected. Notice that menu separators are skipped. | |||||||||||||||
handleKeyEventsSyntax
Arguments
Return Type
| This is called when a keydown event is fired on the menu | |||||||||||||||
hookupMenuSyntax
ArgumentsNo Arguments. Return Type
| Hookups events and connections between the HTML DOM and the JavaScript objects | |||||||||||||||
invalidateSyntax
ArgumentsNo Arguments. Return Type
| Marks the menu as dirty. The next time the menu is shown it is first redrawn | |||||||||||||||
isShownSyntax
ArgumentsNo Arguments. Return Type
| Returns whether the menu is shown or not | |||||||||||||||
removeSyntax
Arguments
Return Type
| Removes a menu item from the menu | |||||||||||||||
resetSizeCacheSyntax
ArgumentsNo Arguments. Return Type
| Clears the cached sizes | |||||||||||||||
setLeftSyntax
Arguments
Return Type
| Depreciated. Use show instead. Sets the left position of the menu | |||||||||||||||
setLocationSyntax
Arguments
Return Type
| Depreciated. Use show instead. Sets both left and top position of the menu | |||||||||||||||
setRectSyntax
Arguments
Return Type
| Depreciated. Use show instead. Sets both location and size of the menu | |||||||||||||||
setSelectedIndexSyntax
Arguments
Return Type
| Selects the menu item with the provided index | |||||||||||||||
setTopSyntax
Arguments
Return Type
| Depreciated. Use show instead. Sets the top position of the menu | |||||||||||||||
showSyntax
Arguments
Return Type
| Shows the menu at the given location and with the given size | |||||||||||||||
toHTMLSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML code needed to draw the menu | |||||||||||||||
updateSizeCacheSyntax
Arguments
Return Type
| Updates the cached sizes if needed. |
Name | Type | Descripton |
closeTimeout | Number | The time in ms to wait before hiding a menu |
cssFile | String | The path to the css file used to define the look of the menu |
items | MenuItem[] | Read only. An array containing the MenuItem objects for the menu |
mouseHoverDisabled | Boolean | If false the mouse hovers selects disabled menu items. If true only keyboard navigations selects disabled items. |
parentMenu | Menu | Read only. The parent menu |
parentMenuItem | MenuItem | Read only. If this menu is a submenu that belongs to a menu item this points at that menu item |
popup | Window | Read only. The popup window used to display the menu |
selectedIndex | Number | Read only. The index of the selected menu item. Use getter and setter instead. |
shownSubMenu | Menu | Read only. If any submenu is shown this will point to that ment |
showTimeout | Number | The time in ms to wait before showing a menu |
Name | Descripton |
None. |
None.
This class represents a menu item
new MenuItem(sLabelText [, fAction [, sIconSrc [, oSubMenu]]])
Name | Type | Descripton |
sLabelText | String | The text to show on the menu item |
fAction | Function or String | Optional. The function to call when the menu item is clicked. If this is a string then it is treated as an URI. |
sIconSrc | String | Optional. The URI to the image to use as icon |
oSubMenu | Menu | Optional. The Menu object to use as a submenu |
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Description | ||||||
closeSubMenuSyntax
Arguments
Return Type
| If the menu item has a sub menu then this will be closed | ||||||
dispatchActionSyntax
ArgumentsNo Arguments. Return Type
| Fires the action on the menu item. If the menu item has a function as it action property then this function is called now. If the action is a string then this is considered to be an URI that the browser should navigate to. | ||||||
getCssClassSyntax
ArgumentsNo Arguments. Return Type
| Returns the class name to use on the table row used to render the menu item | ||||||
getIconCellHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string needed to render the cell with the icon inside it | ||||||
getIconHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string needed to render the icon | ||||||
getSelectedSyntax
ArgumentsNo Arguments. Return Type
| Returns whether the menu item is selected or not | ||||||
getShortcutCellHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML String needed to render the cell containing the shortcut text | ||||||
getShortcutHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string needed to render the shortcut text | ||||||
getSubMenuArrowCellHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string used to render the cell with the sub menu arrow in it | ||||||
getSubMenuArrowHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string used to render the arrow indicating a sub menu | ||||||
getTextCellHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string needed to render the cell with the text inside it | ||||||
getTextHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML string to use for the text on the menu item. If a mnemonic character is set the text is updated to underline that charcter. | ||||||
getToolTipSyntax
ArgumentsNo Arguments. Return Type
| Returns the tooltip text for the menu item | ||||||
makeDisabledContainerSyntax
Arguments
Return Type
| Encloses the argument in the HTML code needed to display the item as disabled | ||||||
positionSubMenuSyntax
ArgumentsNo Arguments. Return Type
| Positions the sub menu relative to the menu item. The size and location as well as the property subMenuDirection is taken into account. | ||||||
scrollIntoViewSyntax
ArgumentsNo Arguments. Return Type
| If the parent menu is scrollable this scrolls the item into view | ||||||
setSelectedSyntax
Arguments
Return Type
| Selects or deselects the menu item | ||||||
showSubMenuSyntax
Arguments
Return Type
| If the menu item has a sub menu then this is shown |
Name | Type | Descripton |
action | Function or String | The action to do when the item is clicked. If this is a function it is called as amethod. If it is a string then this is treated as an URI that will be navigated to. |
disabled | Boolean | If the item is disabled or not |
icon | String | The URI to the iamge to use as icon |
mnemonic | String | The character that can be used to dipatch the action for the menu item. This is the letter that should be underlined in the text of the item. |
shortcut | String | The text to show in the shortcut cell.This is only for informative purpose |
target | String | The name of the target window or frame. This can be used in conjunction with the action property to open links in different window or frames. |
text | String | The text to show on the menu item |
tooltip | String | The text to show as a tooltip when the user hovers the item with the mouse |
visible | Boolean | If false then the menu item is not rendered in the menu. |
Name | Descripton |
None. |
None.
This class extends
MenuItem
and therefore all methods and field available for
MenuItem
are also available for CheckBoxMenuItem
.
This is a menu item that has a check box next to it. When clicked the check box is toggled
new CheckBoxMenuItem(sLabelText [, bChecked [, fAction [, oSubMenu]]])
Name | Type | Descripton |
sLabelText | String | The text to show on the menu item |
bChecked | Boolean | Optional. Whether the item should be checked or not |
fAction | Function or String | Optional. The function to call when the menu item is clicked. If this is a string then it is treated as an URI. |
oSubMenu | Menu | Optional. The Menu object to use as a submenu |
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Description |
None. |
Name | Type | Descripton |
checked | Boolean | Whether the item is checked or not |
Name | Descripton |
None. |
None.
This class extends
MenuItem
and therefore all methods and field available for
MenuItem
are also available for RadioButtonMenuItem
.
This is a menu item that has a check box next to it. When clicked the check box is toggled
new RadioButtonMenuItem(sLabelText [, bChecked [, sRadioGroupName [, fAction [, oSubMenu]]]])
Name | Type | Descripton |
sLabelText | String | The text to show on the menu item |
bChecked | Boolean | Optional. Whether the item should be checked or not |
sRadioGroupName | String | Optional. This is the name of the logical radio group that the menu item should belong to. Notice that only one item can be checked at the same time in the same group. Groups are local to the current menu. |
fAction | Function or String | Optional. The function to call when the menu item is clicked. If this is a string then it is treated as an URI. |
oSubMenu | Menu | Optional. The Menu object to use as a submenu |
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Description |
None. |
Name | Type | Descripton |
checked | Boolean | Whether the item is checked or not |
radioGroupName | String | This is the name of the logical radio group that the menu item should belong to. Notice that only one item can be checked at the same time in the same group. Groups are local to the current menu. |
Name | Descripton |
None. |
None.
This class extends
MenuItem
and therefore all methods and field available for
MenuItem
are also available for MenuSeparator
.
This is a menu item that has a check box next to it. When clicked the check box is toggled
new MenuSeparator()
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Descripton |
None. |
None.
This class extends
Menu
and therefore all methods and field available for
Menu
are also available for MenuBar
.
The class used to create menu bars
new MenuBar()
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Description | ||||||
backupFocusedSyntax
ArgumentsNo Arguments. Return Type
| Saves a reference to the currently focused element for later use | ||||||
createSyntax
ArgumentsNo Arguments. Return Type
| Creates the HTMLElement needed to render the menu bar. This can later be inserted into the tree. | ||||||
getActiveStateSyntax
ArgumentsNo Arguments. Return Type
| Returns the active state. The state can be one of three values: "active" (this occurs when the menu bar is active and no menu is opened), "open" (the menu bar us active but a menu is open) and "inactive" (no menus open and not active). | ||||||
restoreFocusedSyntax
ArgumentsNo Arguments. Return Type
| Restores the backuped focused element | ||||||
setActiveSyntax
Arguments
Return Type
| Sets whether the menu bar should be active. When active, the user can use the keyboard to navigate on the menu bar. | ||||||
toggleActiveSyntax
ArgumentsNo Arguments. Return Type
| Toggles the active state. If active it becomes inactive and the other way around | ||||||
writeSyntax
ArgumentsNo Arguments. Return Type
| Writes the HTML code needed to render the menu bar into the document where this is called |
Name | Type | Descripton |
None. |
Name | Descripton |
None. |
None.
This class extends
MenuItem
and therefore all methods and field available for
MenuItem
are also available for MenuButton
.
This is a menu button that is used on the menu bar.
new MenuButton(sLabelText [, oSubMenu])
Name | Type | Descripton |
sLabelText | String | The text to show on the menu button |
oSubMenu | Menu | Optional. The Menu object to use as a sub menu |
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Description |
None. |
Name | Type | Descripton |
None. |
Name | Descripton |
None. |
None.
Name | Description | ||||||
getMenuItemElementSyntax
Arguments
Return Type
| Returns the first element that represents a menu item |
Name | Type | Descripton |
None. |
Introduction
Menu Creation
Menu Bar Creation
Usage
API
Customizing look & feel
Demos
Download