_GetNewMenuId( ) API Library Routine Example
The following example builds a menu with three items. Before the example can create a menu using _NewMenu( ), it must use _GetNewMenuId( ) to generate a unique MENUID.
SET LIBRARY TO GETNWMID
#include <pro_ext.h>
void putLong(long n)
{
Value val;
val.ev_type = 'I';
val.ev_long = n;
val.ev_width = 10;
_PutValue(&val);
}
FAR GetNewItemId(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 = 10; loc.h = 20;
_SetMenuPoint(menuId, loc);
_MenuInteract(&menuId, &itemId);
_PutStr("\nmenuId ="); putLong(menuId);
_PutStr("\nitemId ="); putLong(itemId);
_DisposeMenu(menuId);
}
FoxInfo myFoxInfo[] = {
{"ONLOAD", (FPFI) GetNewItemId, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};