<menu> ‐ A hierarchical menu
This element is attached to a node and is used to display menus and sub-menus. Each menu is made of items and sub-menus. The selection of an item in a menu or in a sub-menu can be used to trigger an action in the script attached to this node through message passing.
The string value of the value attribute is the text displayed to identify this menu (only if it is a sub-menu).
The integer value of the size attribute defines the number of items and sub-menus contained in this menu.
This element expects an ordered list of sub-menus and items as child nodes.
In the example below, the main menu my_menu_ is made of two items and one sub-menu my_sub_menu. This sub-menu is also made of two items and one sub-menu my_sub_sub_menu made of two items. Figure 5-13 shows a screen shot of the menu described in this example.
<menu id="my_menu_" value="Menu" size="3"> <item message="item1" value="Item 1" /> <menu id="my_sub_menu" value="Sub-menu" size="3"> <item message="sitem1" value="Sub-item 1" /> <menu id="my_sub_sub_menu" value="Sub-sub-menu" size="2"> <item message="ssitem1" value="Sub-sub-item 1" /> <item message="ssitem2" value="Sub-sub-item 2" /> </menu> <item message="sitem2" value="Sub-item 2" /> </menu> <item message="item2" value="Item 2" /> </menu>