Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Weist einem angegebenen Menüeintrag ein Untermenü zu.
void _SetItemSubMenu(MENUID menuid, ITEMID itemid,
MENUID submenuid)
MENUID menuid; /* Menu identifier. */
ITEMID itemid; /* Menu item identifier. */
MENUID submenuid; /* Submenu identifier. */
Hinweise
Sie können _SetItemSubMenu( ) verwenden, um einem Menütitel ein Menü oder einem Menüeintrag ein Untermenü zuzuweisen.
Weitere Informationen zum Erstellen einer API-Bibliothek und ihrer Integration in Visual FoxPro finden Sie unter Zugreifen auf die Visual FoxPro-API.
Beispiel
Im folgenden Beispiel wird dem Systemmenü ein Menütitel hinzugefügt. Mit Hilfe von _SetItemSubMenu( ) wird diesem Menütitel anschließend ein Menü mit zwei Einträgen zugewiesen.
Visual FoxPro-Code
SET LIBRARY TO SETISUBM
C-Code
#include <pro_ext.h>
MENUID SysMenuId;
MENUID PopupId;
ITEMID PadId;
void putLong(long n)
{
Value val;
val.ev_type = 'I';
val.ev_long = n;
val.ev_width = 10;
_PutValue(&val);
}
FAR onSelection(long menuId, long itemId)
{
_PutStr("\nitemId = "); putLong(itemId);
}
void FAR StartUp()
{
ITEMID Bar1Id;
ITEMID Bar2Id;
int Error;
// Add new menu title to SYSMENU.
SysMenuId = _MenuId(_SYSMENU);
PadId = _GetNewItemId(SysMenuId);
if (_NewItem(SysMenuId, PadId, _LASTITEM, "\\<Added menu title"))
{
_Error(623); /* "Menu item cannot be defined." */
}
// Define menu.
PopupId = _GetNewMenuId();
if (Error = _NewMenu(MPOPUP, PopupId))
{
_Error(-Error);
}
Bar1Id = _GetNewItemId(PopupId);
// WARNING: Call _NewItem() before another _GetNewItemId().
if (_NewItem(PopupId, Bar1Id, _LASTITEM, "\\<1st item"))
{
_Error(623); /* "Menu item cannot be defined." */
}
Bar2Id = _GetNewItemId(PopupId);
if (_NewItem(PopupId, Bar2Id, _LASTITEM, "\\<2nd item"))
{
_Error(623); /* "Menu item cannot be defined." */
}
// Attach menu to menu title
_SetItemSubMenu(SysMenuId, PadId, PopupId);
// Set up selection action.
_OnSelection(PopupId, -1, onSelection);
}
void FAR ShutDown()
{
_DisposeItem(SysMenuId, PadId);
_DisposeMenu(PopupId);
}
FoxInfo myFoxInfo[] = {
{"STARTUP", (FPFI) StartUp, CALLONLOAD, ""},
{"SHUTDOWN", (FPFI) ShutDown, CALLONUNLOAD, ""},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
Siehe auch
_GetNewMenuId( ), API-Bibliotheksroutine | _NewMenu( ), API-Bibliotheksroutine | _SetItemText( ), API-Bibliotheksroutine | _SetItemCmdKey( ), API-Bibliotheksroutine