_SetMenuPointP( ) API Library Routine

Specifies in pixels the screen position of the upper-left corner, loc, of a menu.

void _SetMenuPointP(MENUID menuid, Point loc)
MENUID menuid;            /* Menu identifier. */
Point loc;                  /* Position of upper left corner
 of the menu. */

Normally, a menu is automatically positioned based upon its size and how the user invoked it. This routine is provided to override automatic positioning.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

The following example creates a menu and then activates it at three different screen positions specified by _SetMenuPointP( ).

Visual FoxPro Code


C Code

#include <pro_ext.h>

FAR SetMenuPointPEx(ParamBlk FAR *parm)
   MENUID menuId;
   ITEMID itemId;
   Point loc;

   menuId = _GetNewMenuId();
   _NewMenu(MPOPUP, menuId);

   itemId = _GetNewItemId(menuId);
   _NewItem(menuId, itemId, -2, "\\<1st item");

   itemId = _GetNewItemId(menuId);
   _NewItem(menuId, itemId, -2, "\\<2nd item");

   itemId = _GetNewItemId(menuId);
   _NewItem(menuId, itemId, -2, "\\<3rd item");

   loc.v = 40; loc.h = 80;
   _SetMenuPointP(menuId, loc);
   _MenuInteract(&menuId, &itemId);

   loc.v = 80; loc.h = 160;
   _SetMenuPointP(menuId, loc);
   _MenuInteract(&menuId, &itemId);

   loc.v = 160; loc.h = 320;
   _SetMenuPointP(menuId, loc);
   _MenuInteract(&menuId, &itemId);


FoxInfo myFoxInfo[] = {
   {"ONLOAD", SetMenuPointPEx, CALLONLOAD, ""},
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

Community Additions