[[!redirects The Window Manager Menus]] h6. [[WindowManager]] h6(. » [[WindowManager Technical Details|Technical Details]] h6((. » Menus h2(#overview). Overview The Wimp provides a simple yet powerful menu system . Menus may be nested and the user can choose to keep menus open. h2(#opening_a_menu). Opening a Menu RISC OS reserves the middle mouse button for opening menus. Wherefore this button is called the Menu button. The Wimp issues the appropriate [[Mouse_Click|Mouse_Click]] event code upon registering a click of the menu button. An application will usually respond to the event code and open a menu by calling [[Wimp_CreateMenu|Wimp_CreateMenu]]. The Wimp passes a pointer to a data structure that describes a list of menu items, and each menu item may have further pointers to its submenus (if any). Menus can also be made to open a window rather than simply another menu. The window can have icons, sprites and user defined data as required. h2(#creating_a_menu). Creating a Menu As the Wimp notifies the application when a menu is to be opened, the menu tree can be built dynamically at runtime. This allows for context-driven menus easily to be created. The window and icon handles passed by the Wimp give the necessary information for creating a menu relevant to the user. h2(#mouse_clicks). Mouse Clicks Clicks of the menu button over a window are always reported by the Wimp regardless of the [[Window Button Types|Window Button Types]] attribute. When a user makes a selection within a menu (using any mouse button) the Wimp generates another event [[Menu_Selection|Menu_Selection]]. The application should then respond to this by decoding the selected menu item(s) and performing the required actions. The Wimp provides the [[Wimp_DecodeMenu|Wimp_DecodeMenu]] call to aid in calculating which menu item has been selected in which menu. h4(#mouse_button_differences). Mouse Button Differences |<^. Select |The Select button selects the menu item under the mouse pointer and closes the menu.| |<^. Adjust |The Adjust button selects the menu item *but* should keep the menu open to allow the user to make more selections. Some assistance from the application is required, however. See [[Wimp_CreateMenu|Wimp_CreateMenu]] for more details | h2(#writeable_icons). Writeable Icons Menu items can also be made to handle text input. This allows for very easy input from the user while a menu is open. h4. See also * [[Mouse_Click|Mouse_Click]] * [[Wimp_CreateMenu|Wimp_CreateMenu]] * [[Wimp_DecodeMenu|Wimp_DecodeMenu]] * [[Menu_Selection|Menu_Selection]] * [[Window Button Types|Window Button Types]] RISC OS has many guidelines on the appropriate use of menus. For a complete detailed guide on menus please see the RISC OS [[Style Guide|Style Guide]]. [linkStyle]Style+Guide