📄 api.html
字号:
</script>
<div class="webfx-main-body">
<!-- end WebFX Layout Includes -->
<!--
Generated using api.xsl version 020528
-->
<!-- Start main output --><h2 id="Menu">Menu</h2><p>
The class that represents a menu.
</p><h3>Syntax</h3><p><code>
new Menu()</code></p><h3>Parameters</h3><h3>Static Methods</h3><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td colspan="2">None.</td></tr></tbody></table><h3>Static Fields</h3><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>keyboardAccelKey</code></td><td><code>Number</code></td><td>The keyCode for the key that is used to activate the menubar</td></tr><tr><td><code>keyboardAccelProperty</code></td><td><code>String</code></td><td>The preoperty name for the property of the event object used in keyboard related events that when true should disable the defautl action</td></tr></tbody></table><h3>Methods</h3><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">add</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.add(<span class="methodArgument">mi</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>mi</code></td><td><code>MenuItem</code></td><td>The menu item to add</td></tr></tbody></table><h4>Return Type</h4><p><code>MenuItem</code></p></div></div></td><td>Adds a menu item last to the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">areSizesCached</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.areSizesCached()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Boolean</code></p></div></div></td><td>Returns whether the sizes are cached</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">cacheSizes</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.cacheSizes(<span class="methodArgument">bForce</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>bForce</code></td><td><code>Boolean</code></td><td>Force recalculation of the sizes. If false then the size are only recalulated if not already cached</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Depreciated. Use updateSizeCache and/or resetSizeCache instead. Used to recalculate the sizes and cache them for future use</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">close</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.close()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Closes the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">closeAllMenus</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.closeAllMenus()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Closes all menus in the menu tree</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">closeAllSubs</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.closeAllSubs(<span class="methodArgument">oNotThisSub</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oNotThisSub</code></td><td><code>Menu</code></td><td>The menu not to close</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Closes all the sub menus except the provided one. If no argument is passed all subs are closed.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">createPopup</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.createPopup()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Creates the popup object used for the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">drawMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.drawMenu()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Draws the menu inside the popup object. This function does nothing if the menu is not invalidated</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">fixScrollButtons</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.fixScrollButtons()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Fixes the visibility of the scroll buttons</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">fixScrollEnabledState</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.fixScrollEnabledState()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>If the scroll buttons are showed this enables and disables the buttons depending on the current scroll position</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">fixSize</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.fixSize()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Resizes the menu to fit its content</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getDocument</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getDocument()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>HTMLDocument</code></p></div></div></td><td>Returns the document inside the popup used for the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getHeight</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getHeight()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the height of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getInsetBottom</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getInsetBottom()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the distance between the lower outer edge of the menu and the last menu item</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getInsetLeft</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getInsetLeft()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the distance between the outer left edge of the menu and the menu items</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getInsetRight</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getInsetRight()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the distance between the right outer edge of the menu and the menu items</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getInsetTop</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getInsetTop()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the distance between the outer upper edge of the menu and the first menu item</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getLeft</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getLeft()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the left position of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getMeasureDocument</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getMeasureDocument()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>HTMLDocument</code></p></div></div></td><td>Returns a document that can be used to measure the content inside the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getMenuBar</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getMenuBar()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>MenuBar</code></p></div></div></td><td>Returns the first parent menu that is an instance of the class MenuBar</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getPreferredHeight</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getPreferredHeight()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the preferred height of the menu. This is the sum of all items and assuming that no scroll buttons are needed</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getPreferredWidth</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getPreferredWidth()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the preferred width of the menu. This is the width of the widest menu item.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getSelectedIndex</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getSelectedIndex()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the index of the selected menu item</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getTop</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getTop()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the top position of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getWidth</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getWidth()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Number</code></p></div></div></td><td>Returns the width of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">goToNextMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.goToNextMenu()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>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.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">goToNextMenuItem</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.goToNextMenuItem()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>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.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">goToPreviousMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.goToPreviousMenu()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>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.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">goToPreviousMenuItem</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.goToPreviousMenuItem()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>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.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">handleKeyEvents</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.handleKeyEvents(<span class="methodArgument">oEvent</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oEvent</code></td><td><code>Event</code></td><td>The event object used for the keydown event</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>This is called when a keydown event is fired on the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">hookupMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.hookupMenu()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Hookups events and connections between the HTML DOM and the JavaScript objects</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">invalidate</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.invalidate()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Marks the menu as dirty. The next time the menu is shown it is first redrawn</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">isShown</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.isShown()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Boolean</code></p></div></div></td><td>Returns whether the menu is shown or not</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">remove</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.remove(<span class="methodArgument">mi</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>mi</code></td><td><code>MenuItem</code></td><td>The item to remove</td></tr></tbody></table><h4>Return Type</h4><p><code>MenuItem</code></p></div></div></td><td>Removes a menu item from the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">resetSizeCache</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.resetSizeCache()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Clears the cached sizes</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">setLeft</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.setLeft(<span class="methodArgument">nLeft</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nLeft</code></td><td><code>Number</code></td><td>The new left position</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Depreciated. Use show instead. Sets the left position of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">setLocation</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.setLocation(<span class="methodArgument">nLeft</span>, <span class="methodArgument">nTop</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nLeft</code></td><td><code>Number</code></td><td>The new left position</td></tr><tr><td><code>nTop</code></td><td><code>Number</code></td><td>The new top position</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Depreciated. Use show instead. Sets both left and top position of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">setRect</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.setRect(<span class="methodArgument">nLeft</span>, <span class="methodArgument">nTop</span>, <span class="methodArgument">nWidth</span>, <span class="methodArgument">nHeight</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nLeft</code></td><td><code>Number</code></td><td>The new left position</td></tr><tr><td><code>nTop</code></td><td><code>Number</code></td><td>The new top position</td></tr><tr><td><code>nWidth</code></td><td><code>Number</code></td><td>The new width position</td></tr><tr><td><code>nHeight</code></td><td><code>Number</code></td><td>The new height position</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Depreciated. Use show instead. Sets both location and size of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">setSelectedIndex</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.setSelectedIndex(<span class="methodArgument">nIndex</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nIndex</code></td><td><code>Number</code></td><td>The index of the menu item to select</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Selects the menu item with the provided index</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">setTop</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.setTop(<span class="methodArgument">nTop</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nTop</code></td><td><code>Number</code></td><td>The new top position</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Depreciated. Use show instead. Sets the top position of the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">show</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.show([<span class="methodArgument">left</span> [, <span class="methodArgument">top</span> [, <span class="methodArgument">width</span> [, <span class="methodArgument">height</span>]]]])</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>left</code></td><td><code>Number</code></td><td><span class="optional">Optional.</span> The left position<span class="defaultSentence">
The default value is <code>0</code>.
</span></td></tr><tr><td><code>top</code></td><td><code>Number</code></td><td><span class="optional">Optional.</span> The top position<span class="defaultSentence">
The default value is <code>0</code>.
</span></td></tr><tr><td><code>width</code></td><td><code>Number</code></td><td><span class="optional">Optional.</span> The width of the menu</td></tr><tr><td><code>height</code></td><td><code>Number</code></td><td><span class="optional">Optional.</span> The height of the menu</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Shows the menu at the given location and with the given size</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">toHTML</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.toHTML()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML code needed to draw the menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">updateSizeCache</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.updateSizeCache(<span class="methodArgument">bForce</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>bForce</code></td><td><code>Boolean</code></td><td>If true then the sizes will be recalculated even if there might not be necessary</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Updates the cached sizes if needed.</td></tr></tbody></table><h3>Fields</h3><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>closeTimeout</code></td><td><code>Number</code></td><td>The time in ms to wait before hiding a menu</td></tr><tr><td><code>cssFile</code></td><td><code>String</code></td><td>The path to the css file used to define the look of the menu</td></tr><tr><td><code>items</code></td><td><code>MenuItem[]</code></td><td><span class="readOnly">Read only.</span> An array containing the MenuItem objects for the menu</td></tr><tr><td><code>mouseHoverDisabled</code></td><td><code>Boolean</code></td><td>If false the mouse hovers selects disabled menu items. If true only keyboard navigations selects disabled items.</td></tr><tr><td><code>parentMenu</code></td><td><code>Menu</code></td><td><span class="readOnly">Read only.</span> The parent menu</td></tr><tr><td><code>parentMenuItem</code></td><td><code>MenuItem</code></td><td><span class="readOnly">Read only.</span> If this menu is a submenu that belongs to a menu item this points at that menu item</td></tr><tr><td><code>popup</code></td><td><code>Window</code></td><td><span class="readOnly">Read only.</span> The popup window used to display the menu</td></tr><tr><td><code>selectedIndex</code></td><td><code>Number</code></td><td><span class="readOnly">Read only.</span> The index of the selected menu item. Use getter and setter instead.</td></tr><tr><td><code>shownSubMenu</code></td><td><code>Menu</code></td><td><span class="readOnly">Read only.</span> If any submenu is shown this will point to that ment</td></tr><tr><td><code>showTimeout</code></td><td><code>Number</code></td><td>The time in ms to wait before showing a menu</td></tr></tbody></table><h3>Events</h3><table><thead><tr><td>Name</td><td>Descripton</td></tr></thead><tbody><tr><td colspan="2">None.</td></tr></tbody></table><h3>Remarks</h3><p>
None.
</p><h2 id="MenuItem">MenuItem</h2><p>
This class represents a menu item
</p><h3>Syntax</h3><p><code>
new MenuItem(<span class="methodArgument">sLabelText</span> [, <span class="methodArgument">fAction</span> [, <span class="methodArgument">sIconSrc</span> [, <span class="methodArgument">oSubMenu</span>]]])</code></p><h3>Parameters</h3><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sLabelText</code></td><td><code>String</code></td><td>The text to show on the menu item</td></tr><tr><td><code>fAction</code></td><td><code>Function or String</code></td><td><span class="optional">Optional.</span>
The function to call when the menu item is clicked. If this is a string then it is treated as an URI.
</td></tr><tr><td><code>sIconSrc</code></td><td><code>String</code></td><td><span class="optional">Optional.</span> The URI to the image to use as icon</td></tr><tr><td><code>oSubMenu</code></td><td><code>Menu</code></td><td><span class="optional">Optional.</span> The Menu object to use as a submenu</td></tr></tbody></table><h3>Static Methods</h3><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td colspan="2">None.</td></tr></tbody></table><h3>Static Fields</h3><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td colspan="3">None.</td></tr></tbody></table><h3>Methods</h3><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">closeSubMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.closeSubMenu([<span class="methodArgument">bDelayed</span>])</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>bDelayed</code></td><td><code>Boolean</code></td><td><span class="optional">Optional.</span> If true then the closing of the sub menu will be delayed Menu.prototype.closeTimeout ms<span class="defaultSentence">
The default value is <code>false</code>.
</span></td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>If the menu item has a sub menu then this will be closed</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">dispatchAction</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.dispatchAction()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>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.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getCssClass</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getCssClass()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the class name to use on the table row used to render the menu item</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getIconCellHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getIconCellHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML string needed to render the cell with the icon inside it</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getIconHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getIconHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML string needed to render the icon</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getSelected</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getSelected()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>Boolean</code></p></div></div></td><td>Returns whether the menu item is selected or not</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getShortcutCellHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getShortcutCellHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML String needed to render the cell containing the shortcut text</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getShortcutHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getShortcutHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML string needed to render the shortcut text</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getSubMenuArrowCellHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getSubMenuArrowCellHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML string used to render the cell with the sub menu arrow in it</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getSubMenuArrowHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getSubMenuArrowHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML string used to render the arrow indicating a sub menu</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getTextCellHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getTextCellHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the HTML string needed to render the cell with the text inside it</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getTextHtml</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getTextHtml()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>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.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">getToolTip</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.getToolTip()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Returns the tooltip text for the menu item</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">makeDisabledContainer</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.makeDisabledContainer(<span class="methodArgument">s</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>s</code></td><td><code>String</code></td><td>The text to enclose</td></tr></tbody></table><h4>Return Type</h4><p><code>String</code></p></div></div></td><td>Encloses the argument in the HTML code needed to display the item as disabled</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">positionSubMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.positionSubMenu()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Positions the sub menu relative to the menu item. The size and location as well as the property subMenuDirection is taken into account.</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">scrollIntoView</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.scrollIntoView()</code></p><h4>Arguments</h4><p>No Arguments.</p><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>If the parent menu is scrollable this scrolls the item into view</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">setSelected</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.setSelected(<span class="methodArgument">bSelected</span>)</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>bSelected</code></td><td><code>Boolean</code></td><td>Whether to select the item or not</td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>Selects or deselects the menu item</td></tr><tr><td><a class="helpLink" href="javascript://" onclick="toggleMethodArguments( event, this ); return false;">showSubMenu</a><div class="methodContainer"><div class="methodInfo"><h4>Syntax</h4><p><code><span class="object">object</span>.showSubMenu([<span class="methodArgument">bDelayed</span>])</code></p><h4>Arguments</h4><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>bDelayed</code></td><td><code>Boolean</code></td><td><span class="optional">Optional.</span> If true then the showing of the sub menu will be delayed Menu.prototype.showTimeout ms<span class="defaultSentence">
The default value is <code>false</code>.
</span></td></tr></tbody></table><h4>Return Type</h4><p><code>void</code></p></div></div></td><td>If the menu item has a sub menu then this is shown</td></tr></tbody></table><h3>Fields</h3><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>action</code></td><td><code>Function or String</code></td><td>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.</td></tr><tr><td><code>disabled</code></td><td><code>Boolean</code></td><td>If the item is disabled or not</td></tr><tr><td><code>icon</code></td><td><code>String</code></td><td>The URI to the iamge to use as icon</td></tr><tr><td><code>mnemonic</code></td><td><code>String</code></td><td>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.</td></tr><tr><td><code>shortcut</code></td><td><code>String</code></td><td>The text to show in the shortcut cell.This is only for informative purpose</td></tr><tr><td><code>target</code></td><td><code>String</code></td><td>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.</td></tr><tr><td><code>text</code></td><td><code>String</code></td><td>The text to show on the menu item</td></tr><tr><td><code>tooltip</code></td><td><code>String</code></td><td>The text to show as a tooltip when the user hovers the item with the mouse</td></tr><tr><td><code>visible</code></td><td><code>Boolean</code></td><td>If false then the menu item is not rendered in the menu.</td></tr></tbody></table><h3>Events</h3><table><thead><tr><td>Name</td><td>Descripton</td></tr></thead><tbody><tr><td colspan="2">None.</td></tr></tbody></table><h3>Remarks</h3><p>
None.
</p><h2 id="CheckBoxMenuItem">CheckBoxMenuItem</h2><p>This class extends
<code><a href="#MenuItem">MenuItem</a></code>
and therefore all methods and field available for
<code><a href="#MenuItem">MenuItem</a></code>
are also available for <code>CheckBoxMenuItem</code>.</p><p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -