h6. [[WindowManager]] h6(. » [[WindowManager SWI Calls|SWI Calls]] h6((. » Wimp_CreateMenu h2. Wimp_CreateMenu h5. (SWI &400D4) |_<. Entry | | |/3^. R1 |Pointer to [[Menu Block|Menu Block]] or | | Window handle, or | |–1 means close any active menu | |R2 |X co-ordinate of top-left corner of top level menu | |R3 |Y co-ordinate of top-left corner of top level menu | |_<. Exit | | |R0 |Corrupt | h4. Use The purpose of this call is to create and display a menu structure. A menu window to open can be a traditional menu containing menu items or it can also be a window such as a [[The Window Manager Dialog Boxes|dialog box]]. Having used this call, applications should return to its normal polling loop. Further sub-menus are opened via [[Wimp_CreateSubMenu|Wimp_CreateSubMenu]]. The Wimp maintains the menu tree until a mouse click is detected. If the click was within a menu, then a Menu [[Menu_Selection|Menu_Selection]] event code is returned from [[Wimp_Poll|Wimp_Poll]], along with a list of selections. If the click was detected outside of a menu, then the Wimp closes all menus. h4(#notes). Notes A menu is actually a window with its work area entirely covered by menu items. However, any window can be opened as a menu if R1 contains the window handle. The Wimp will automatically display a vertical scroll bar if a menu is taller than the current screen mode When a menu is closed, the caret is automatically given back to wherever it was before the window was opened. Pressing the Return key while the caret is inside a writable menu item is equivalent to a mouse click. It is conventional that menu items clicked with the Adjust button should keep the menu structure open so further selections can be made. For this to happen, the Wimp temporarily marks the menu tree when a selection is made. To confirm which mouse button was clicked, [[Wimp_GetPointerInfo|Wimp_GetPointerInfo]] should then be called. If the adjust button was clicked, then Wimp_CreateMenu should be called before returning to Wimp_Poll so that the menu tree to be re-opened as before. The menu structure can also be modified (if required) before re-opening. To aid with identifying which menu item was selected by the user, the [[Wimp_DecodeMenu|Wimp_DecodeMenu]] can be used. h4. See also * [[Wimp_CreateSubMenu|Wimp_CreateSubMenu]] * [[Wimp_DecodeMenu|Wimp_DecodeMenu]] * [[Wimp_GetPointerInfo|Wimp_GetPointerInfo]] * [[Wimp_Poll|Wimp_Poll]] * [[Menu Block|Menu Block]] * [[Menu_Selection|MenuSelection]] * [[The Window Manager Menus|Menus]]