RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Wimp_CreateMenu

WindowManager
» SWI Calls
» Wimp_CreateMenu

Wimp_CreateMenu

(SWI &400D4)
Entry
R1 Pointer to 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

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 dialog box.

Having used this call, applications should return to its normal polling loop. Further sub-menus are opened via 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 event code is returned from Wimp_Poll, along with a list of selections. If the click was detected outside of a menu, then the Wimp closes all menus.

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 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 can be used.

See also

  • Wimp_CreateSubMenu
  • Wimp_DecodeMenu
  • Wimp_GetPointerInfo
  • Wimp_Poll
  • Menu Block
  • MenuSelection
  • Menus
Revised on December 9, 2013 14:41:50 by Jeffrey Lee (213) (91.84.11.161)
Edit | Back in time (1 revision) | See changes | History | Views: Print | Source | Linked from: Menu Items, WindowManager SWI Calls, WindowManager Dialog Boxes, WindowManager Applications And Documents, Item Flags, Wimp_CreateSubMenu, Wimp_DecodeMenu, Menu_Selection, Message_MenusDeleted, Menu Block, Font_ListFonts (Menu), WindowManager Menus

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys