Hello,
I am developing an application which makes use of several pop up menus that are built on-the-fly. The menus are created using:
MENU_Handle hMenu = MENU_CreateEx(0, 0, 0, 0, WM_UNATTACHED, 0, MENU_CF_VERTICAL, 0);
and populated:
static void prvAddEntry(MENU_Handle hMenu, const char *label, U16 id, U16 flags) {
MENU_ITEM_DATA entry;
entry.pText = label;
entry.Id = id;
entry.Flags = flags;
entry.hSubmenu = 0;
MENU_AddItem(hMenu, &entry);
}
If I need to display the menu, then calling:
MENU_Popup(hMenu, hDialog, 0, 0, 0, 0, 0);
WM_SetFocus(hMenu);
shows the menu and gives it keyboard focus. The problem I am having occurs when I come to delete the menu. The manual states that the menu will not be automatically deleted, but when I call WM_DeleteWindow(hMenu) I get a bus fault exception with a PC in GUI_ALLOC_h2p and link register in WM__GetTopLevelLayer.
What is the correct way to delete a pop up menu widget and free the resources that have been allocated?
Regards,
Craig
I am developing an application which makes use of several pop up menus that are built on-the-fly. The menus are created using:
MENU_Handle hMenu = MENU_CreateEx(0, 0, 0, 0, WM_UNATTACHED, 0, MENU_CF_VERTICAL, 0);
and populated:
static void prvAddEntry(MENU_Handle hMenu, const char *label, U16 id, U16 flags) {
MENU_ITEM_DATA entry;
entry.pText = label;
entry.Id = id;
entry.Flags = flags;
entry.hSubmenu = 0;
MENU_AddItem(hMenu, &entry);
}
If I need to display the menu, then calling:
MENU_Popup(hMenu, hDialog, 0, 0, 0, 0, 0);
WM_SetFocus(hMenu);
shows the menu and gives it keyboard focus. The problem I am having occurs when I come to delete the menu. The manual states that the menu will not be automatically deleted, but when I call WM_DeleteWindow(hMenu) I get a bus fault exception with a PC in GUI_ALLOC_h2p and link register in WM__GetTopLevelLayer.
What is the correct way to delete a pop up menu widget and free the resources that have been allocated?
Regards,
Craig