Posted by: pachamuthu | May 28, 2009

MenuBar Control

Definition:

Ø        A MenuBar Control displays the top level of a menu as a horizontal bar of menu items, where each item on the bar can pop up a submenu.  The MenuBar Control interprets the data provider in the same way as the menu control and supports the same events as the menu control.  ØA menubar is static, it does not function as a popup menu, and always visible in your application, because the menubar is static, you can Ø define it directly in mxml.

 
ØCreating a menubar control:
1.       A Menubar Control in Mxml by using the <mx:menubar> tag, specify an id value if you intend to refer to a component elsewhere in your mxml application either in another tag or in an actionscript block. specify the data for the menubar control by using the dataprovider property,2.By using the dataprovider property, 3.Use an <mx:XML> or <mx:XMLList> tag.
ØThe following rules in mind:
1.          With the <mx:XML>tag  you must have a single root node and you set the show root property of the menubar control to false.
2.          With the <mx:XMLList> tag you define a list of xml nodes, and the top level nodes define the bar buttons. 
3.          Data provider has a label attribute
   Label field = “@label”

Ø
          The same as for the menu control. The Menubar Control has the focus, the left arrow, opens the previous menu. If the current menubar item has a closed popup menu, the right arrow opens the current menu, if the popup menu is open, the right arrow opens the next menu.1.with regards,
 

2.

<?xml version=”1.0″?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” >

<mx:MenuBar id=”myMenuBar” labelField=”@label”>
<mx:XMLList>

<menuitem label=”FileMenu”>
<menuitem label=”New” enabled=”true”/>
<menuitem label=”Open”/>
<menuitem label=”Save”/>
<memuitem label=”Save As”/>
</menuitem>

<menuitem label=”EditMenu”>
<menuitem label=”Cut” color=”red”/>
<menuitem label=”Copy”/>
<menuitem label=”Paste”/>
</menuitem>

<menuitem label=”ViewMenu”>
<menuitem label=”GoTo”/>
<menuitem label=”Stop”/>
<menuitem label=”Research”/>
</menuitem>

<menuitem label=”FontMenu”>
<menuitem label=”Font Color”
type=”radio” groupName=”one”/>
<menuitem label=”Font Size”
type=”radio” groupName=”one”
selected=”true”/>
<menuitem label=”Font Family”
type=”radio” groupName=”one”/>
</menuitem>

</mx:XMLList>
</mx:MenuBar>
</mx:Application>

 

 Source Code:Menubar Control User Interaction:

pachamuthu.p


Leave a response

Your response:

Categories