PopupMenu(id[, x, y])
id as a popup menu. Popup menus are
also known as context menus and are typically shown when the user presses the right mouse
button at a certain area of the display. The menu strip passed to PopupMenu() must have
been created using either CreateMenu() or @MENU and it must only
consist of a single strip. The title of the menu strip is ignored.
The optional arguments x and y allow you to specify the desired position of the popup
menu. Note that this must be passed in coordinates relative to the screen's top-left corner,
i.e. if you pass 0 for x and y, the popup menu will appear in the top-left corner of the
screen. If you omit the x and y arguments, the popup menu will be shown at the location
of the mouse pointer.
PopupMenu() will block the script execution until the user has selected a menu item
or closed the popup menu. Just as with normal menu events, popup menu events will be sent
to your script through the OnMenuSelect event handler. See InstallEventHandler for details.
Note that on AmigaOS and compatibles the right mouse button is typically reserved for
accessing the screen menu. If you want to be able to listen to the right mouse button to
show a popup menu, you need to set the TrapRMB tag to True. See DISPLAY for details.
CreateMenu(1, {{"Unused", {
{"Cut", ID = "cut"},
{"Copy", ID = "copy"},
{"Paste", ID = "paste"},
{""},
{"Undo", ID = "undo"},
{"Redo", ID = "redo"}
}}})
PopupMenu(1)
The code above defines and shows a popup menu.