Main Page | Packages | Class Tree | Index | Help

xp.controls

class MenuBar

MovieClip
  |
  +--xp.system.UIControl
        |
        +--xp.controls.Menu
              |
              +--xp.controls.MenuBar


class MenuBar
extends Menu

MenuBar
The MenuBar component lets you create a horizontal or vertical menu bar with pop-up menus and commands, just like the menu bars that contain File and Edit menus in common software applications.
The MenuBar component complements the Menu component by providing a clickable interface to show and hide menus that behave as a group for mouse and keyboard interactivity.

The MenuBar component lets you create an application menu in a few steps.
To build a menu bar, you can either assign an XML data source to the menu bar that describes a series of menus, or use the MenuBar.addMenu() method to add menu instances one at a time.
Events:
select xp.events.MenuSelectEvent
activate xp.events.MenuActivateEvent


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public static
activeMenu: Object
internal vars the currently actve main menu

public static
activeSubMenu: Object
the currently actve mi

public static
classInfo: Object
A static class information object

public
openOnRollOver: Boolean
Controls whether sub menus open when moused over; if false they require an explicit click to open

public
styleClass: String
The name of the style class this instance will use.

Fields inherited from class xp.controls.Menu

classInfo, itemSpacing, styleClass

Fields inherited from class xp.system.UIControl

__layout, allowDrop, autoLayout, bindingDefaultValue, bindingFormatter, bindingPath, bindingSource, bindingType, bindingValidator, border, causesValidation, classInfo, clickOnENTER, clickOnSPACE, container, context, data, disableAcceptButton, disableCancelButton, enableBGMouseEvents, enableDblClickEvent, enableKeyDownEvents, enableKeyEvents, enableKeyUpEvents, enableMouseWheelEvents, formatterOptions, horizontalAlignment, index, isBinding, itemId, logEnabled, parent, parentContainer, parentForm, percentageHeight, percentageWidth, styleClass, tabIndex, tabStop, tooltip, tree, verticalAlignment

Property Summary

public
dataProvider: Object (read, write)
The hierarchy of objects to be displayed as menus.

public
document: XMLNode (read, write)


public
groupExpandDirection: String (read, write)
The directions of expansion for Menu groups when they open

public
itemsSource: ListDataSource (read, write)
Gets or sets an itemsSource

public
source: String (read, write)
The URL of an XML dcoument to be loaded

Properties inherited from class xp.system.UIControl

alpha, autosize, background, backgroundVisible, bindings, borderBrush, borderRadius, borderShadow, borderStyle, borderThickness, bottom, dataSource, enableMouseEvents, focusManager, height, id, isEnabled, isFocused, isMouseOver, isPressed, isSelected, isValid, layout, left, margin, maxHeight, maxWidth, measuredHeight, measuredMinHeight, measuredMinWidth, measuredWidth, minHeight, minWidth, padding, readOnly, resources, right, styleName, top, triggers, visible, width, x, y

Constructor

public
MenuBar ( )
Constructor - This should not be called directly.


Method Summary

public
addMenuItemNode ( parentId: String, node: XMLNode )
Adds an nested xml node to the menubar

public
addSubMenuItem ( parentId: String, params: Object ): MenuItem
Add an item to a submenu

public
close ( ): Void
Close this menu and all open sub menu's

public
getClass ( ): Function
Returns a reference to the components static class

public
getMenu ( id: String )
Get a reference to the menu using the menu's Id

public
modelChangedHandler ( e: Event ): Void


public static
newInstance ( owner, instanceId, depth, initObj )
Creates a new Instance of this class

public
showMenu ( mi ): Void
Display a menu

public
showSubMenu ( mi ): Void
Display a submenu

Methods inherited from class xp.controls.Menu

addMenuItem, close, getClass

Methods inherited from class xp.system.UIControl

addBinding, addBindings, addEventListener, addPropertyTrigger, applyStyle, beginDeferUpdate, canUpdate, centerContent, checkState, containsFocus, destroy, destroyObject, drawFocus, endDeferUpdate, findFocusFromObject, findFocusInChildren, getBinding, getBounds, getCenter, getClass, getFocus, getFocusManager, getFocusRect, getLocation, getPropertyValue, getSize, getStateName, getTrigger, globalToLocalPoint, invalidate, invalidateLayout, invalidateSize, invalidateSizeAndLayout, invalidChild, isChild, isMouseDirectlyOver, isParent, localToGlobalPoint, localToLocalPoint, measure, mouseWheel, move, onChildFocus, onKillFocus, onSetFocus, processEnterKey, processEscapeKey, processTabKey, redraw, refresh, removeEventListener, routeEvent, setBounds, setFocus, setLocation, setPropertyValue, setSize, setValueChanged, update, validate



Field Documentation

activeMenu

public static var activeMenu: Object
internal vars the currently actve main menu

activeSubMenu

public static var activeSubMenu: Object
the currently actve mi

classInfo

public static var classInfo: Object
A static class information object

Every class has an associated classInfo object that holds the version and other static information. The classInfo can be accessed either directly by referencing the static class or by calling getClass() on any class instance.

openOnRollOver

public var openOnRollOver: Boolean
Controls whether sub menus open when moused over; if false they require an explicit click to open

styleClass

public var styleClass: String
The name of the style class this instance will use.


Property Documentation

dataProvider

public dataProvider: Object (read, write)
The hierarchy of objects to be displayed as menus.

An array of list items. When this property is set, internally the array is wrapped in a ListDataSource and passed to the itemsSource property

document

public document: XMLNode (read, write)

groupExpandDirection

public groupExpandDirection: String (read, write)
The directions of expansion for Menu groups when they open

itemsSource

public itemsSource: ListDataSource (read, write)
Gets or sets an itemsSource

The datasource object that will be used to populate the MenuBar.

source

public source: String (read, write)
The URL of an XML dcoument to be loaded


Constructor Documentation

MenuBar

public function MenuBar()
Constructor - This should not be called directly.

If you want to dynamically create a new instance of a control use its static newInstance method


Method Documentation

addMenuItemNode

public function addMenuItemNode(parentId: String,
 node: XMLNode)
Adds an nested xml node to the menubar

Parameters:
parentId
the id of the parent menu, null if this is a top level item
node
the xml node to add

addSubMenuItem

public function addSubMenuItem(parentId: String,
 params: Object): MenuItem
Add an item to a submenu

Just a wrapper round the addMenuItem method of the Menu class-actually is a submenuitem....

Parameters:
parentId
Id of the parent Menu to add to
params
Returns:
A reference to the new MenuItem

close

public function close(): Void
Close this menu and all open sub menu's

For top level menu's we also disconnect the mousedown checker and reset our depth back to normal

Overrides:
Menu.close in class Menu

getClass

public function getClass(): Function
Returns a reference to the components static class

Overrides:

getMenu

public function getMenu(id: String)
Get a reference to the menu using the menu's Id

Parameters:
id
The menu Id
Returns:
A reference to the menu

modelChangedHandler

public function modelChangedHandler(e: Event): Void

newInstance

public static function newInstance(owner,
 instanceId,
 depth,
 initObj)
Creates a new Instance of this class

Creates an instance of a component at runtime. You need to use the import statement and specify the class package name before calling this method. In addition, the component must be in the FLA file’s library.

Parameters:
owner
A reference to the movie clip or object that will contains the new Instance.
instanceId
A string indicating the instance name of the new instance.(optional)
depth
A number indicating the depth of the new instance.(optional)
initObj
An object containing initialization properties for the new instance.(optional)
Returns:
A object that is an instance of the specified class.

showMenu

public function showMenu(mi): Void
Display a menu

For the top level menu activation/deactivation

Parameters:
mi
The Id of the Menu

showSubMenu

public function showSubMenu(mi): Void
Display a submenu

Parameters:
mi
The Id of the Menu

The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc