RunPopupMenu

int RunPopupMenu (int menuBarHandle, int menuID, int panelHandle, int top, int left, int pinTop, int pinLeft, int pinHeight, int pinWidth);

Purpose

Displays a menu and tracks mouse and keyboard events on the menu.

If the user selects an item from the menu, the following actions occur:

In most cases, call this function from a User Interface panel or control callback function that has received a LEFT_CLICK, RIGHT_CLICK, or KEYPRESS event.

Parameters

Input
Name Type Description
menuBarHandle integer Specifier for a particular menu bar that is currently in memory. You obtain this handle from LoadMenuBar or NewMenuBar.

If the menu bar was automatically loaded through LoadPanel, use GetPanelMenuBar to get the menu bar handle.
menuID integer ID for a particular menu within a menu bar. The ID must be a constant name, located in the .uir header file, that you assign in the User Interface Editor or a value that you obtain from NewMenu.
panelHandle integer Handle for the panel over which you want the menu to appear. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.

The top, left, pinLeft, and pinRight parameters are relative to the top, left corner of this panel.
top integer Vertical coordinate at which to place the upper left corner of the menu. The coordinate must be an integer value from –32,768 to 32,767. The coordinate represents the pixel offset from the top of the panel that panelHandle specifies.
left integer Horizontal coordinate at which to place the upper left corner of the menu. The coordinate must be an integer value from –32,768 to 32,767. The coordinate represents the pixel offset from the left edge of the panel that panelHandle specifies.
pinTop integer The pin area is obsolete and is ignored. The menu remains visible wherever the user releases the mouse button.
pinLeft integer The pin area is obsolete and is ignored. The menu remains visible wherever the user releases the mouse button.
pinHeight integer The pin area is obsolete and is ignored. The menu remains visible wherever the user releases the mouse button.
pinWidth integer The pin area is obsolete and is ignored. The menu remains visible wherever the user releases the mouse button.

Return Value

Name Type Description
menuItemSelected integer If the user selects a menu item, the function returns the ID of the menu item. If the user releases the pop-up menu without selecting an item, the function returns 0. If an error occurs, the function returns a negative value.

>0 ID of menu item selected.
0 User did not select a menu item.