Prev | Current Page 972 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

win.Menus( isPopup );
The call to the Menus constructor requires a Boolean value that is true if the menu will be a pop - up,
context style menu, or false if it is to be attached to a menu bar.
Once you have your menu object, you can then start adding items. Items are either selectable entries,
dividers, or submenus. To add a selectable item, you use addItem :
menu.addItem( text, id );
The first parameter to addItem is the text that will display in the menu for the item, while the second
parameter references that integer value that will be returned should it be selected. This integer value also
represents the location of the item, as all items are shown in numerical order, with the lowest value
integer sitting at the top of the menu and the highest at the bottom. You must make sure that the passed
id is unique.
Occasionally, you will want to break up your menu items with the use of dividers. These are easy to
implement. You simply use the addDivider method, passing it the unique location of the divider,
like this:
menu.


Pages:
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984