Method XbpMenu():popUp() Foundation

Displays and activates a popup menu.

:popUp( [<oXbp>], <aPos>, ;
        [<nDefaultItem>], [<nControl>] ) --> lSuccess
The optional parameter <oXbp> specifies an Xbase Part over which the XbpMenu object is displayed. <oXbp> defines the origin for the coordinates specified in the <aPos> array. By default the parent of the XbpMenu object is used as <oXbp>.
<aPos> := { nX, nY }
<aPos> is an array containing two elements that specify the position where the XbpMenu object is displayed. The first element contains the x coordinate and the second element contains the y coordinate. The coordinates are relative to the coordinate system of <oXbp>.
<nDefaultItem> is a numeric value specifying the ordinal position of the default menu item. This menu item is highlighted when the menu is first displayed. The default value is 1.
Windows ignores this parameter.
The <nControl> parameter specifies how the popup menu is controlled. Constants defined in the XBP.CH file must be used for this value. The valid constants begin XBPMENU_PU_ and must be added if several control characteristics are combined. The default value is XBPMENU_PU_DEFAULT.

This method returns the value .T. (true) if the XbpMenu object could be displayed, otherwise .F. (false) is returned.


An XbpMenu object is either used as a submenu within a menu system or as an independent context menu. Context menus are generally displayed after the right mouse button is clicked. The :popUp() method of the XbpMenu object is used to display and activate the popup menu. The display position depends on the <oXbp> and <aPos> parameters. The value specified for the <oXbp> parameter is generally the third message parameter of the AppEvent() function which is also the third parameter of the callback code block for the right mouse click event. The values specified in the <aPos> parameter are generally the first message parameter since this is the position of the mouse pointer (see the example).

The behavior of the popup menu depends on the constant specified for the <nControl> parameter. The constants listed in the following table define the behavior of the popup menu. These differ from other #define constants, in that they can be added to create many possible combinations.

Constants for controlling the display of popup menus
Constant Description
XBPMENU_PU_MOUSE_LB *) Menu reacts to the left mouse button
XBPMENU_PU_MOUSE_RB *) Menu reacts to the right mouse button
  1. The sum or these constants is the default XBPMENU_PU_DEFAULT

The default for controlling popup menus corresponds to the XBPMENU_PU_DEFAULT constant which includes all of the constants marked with *) in the table above. Using the default value, popup menus are entirely visible, selection can occur using either the keyboard or any mouse button, and the menu remains visible on the screen until a selection is made or a key is pressed.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.