When you create a NativeMenu object using the
Menu.createFromXML()
or
Menu.createFromJSON()
method,
the structure of XML elements or objects defines the structure of
the resulting menu. Once the menu is created, you can change its
structure or properties at run time. To change a menu item at run
time you access the NativeMenuItem object by navigating through
the NativeMenu object’s hierarchy.
The MenuBuilder framework looks for certain XML attributes or
object properties as it parses through the menu data source. The
presence and value of those attributes or properties determines
the structure of the menu that’s created.
When you use XML for the menu structure, the XML file must contain
a root node. The child nodes of the root node are used as the top-level
menu item nodes. The XML nodes can have any name. The names of the
XML nodes don’t affect the menu structure. Only the hierarchical
structure of the nodes and their attribute values are used to define
the menu.
|
|
|