Similar to the Miles menu, we now consider the implementation of the Fruits menu, which contains multiple levels. It is implemented by the following call :
install_menu('Fruit', [apple([ 'Granny Smith', 'Delicious'(['Red','Golden']), 'Macintosh', 'Cox']), pear, orange(['Jaffa', 'Seville', 'Navel'])]).
'Delicious'( 'Golden')
will be called
orange( 'Seville')
will be called
Figure 5: The Fruit Menu added to the Menu Bar
kill_menu(Menu)command. If a menu has submenus, all of the submenus will also be deleted (removed). It is possible to remove a submenu from within a menu (like Fruit above) with this command - so that entries in the top level menu are automatically adjusted
clear_menu(Menu)removes all entries from a menu - although the menu will still exist - but it will contain no items
disable_menu(Menu)The whole menu Menu is disabled - its colour on the menu bar (if it it a top level menu) is 'greyed out' - and all items in it also appear grey
enable_menu(Menu)will enable a previously disabled Menu
is_menu(Menu)Is to check if Menu exists ... from within the program
get_menus(Menus)Returns a list of current menus in the variable Menus - no indication is provided of whether a menu is in the menu bar, a hierarchical submenu or a popup menu
Figure 9: The Fruit Menu - disabled
extend_menu(Menu,Items)
for instance, the call
extend_menu('Edit',['Make me coffee'])will add a new entry to the existing Edit menu
Figure 11: The Edit Menu - with the additional entry
disable_item(Menu,Item) enable_item(Menu,Item)
rename_item('Eval','Enter',' /T')
Figure 13: The Eval Menu - with the compile and Enter renamed