The interface, IMenu , is required to
provide an interchangeable association between menu items, represented by the Item class, and
submenu items represented by the Submenu class.
Creating a Menu
To create a menu, you must first instantiate the Menu class, passing it an identifier string. This string can
be any text you like, but will later be used to assign the menu to the dialog, so it should generally be
something appropriate.
var menu = new Menu(???Menu Identifier??? );
Once the Menu class is instantiated, you can then start adding Item s. If the containing Menu object is
the parent in the menu hierarchy, then any added Item s will show across the top of the Dialog .
Likewise, if the menu has been assigned to a Submenu object, then the added Item s will be displayed
within a pop - up container. You add Item s to a Menu object using its addItem method, as shown in the
following example:
menu.addItem( myItem );
A separator can also be added in this fashion by assigning two hyphens ( - - ) as the label of the
item.
Pages:
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922