Forum Discussion
jaxjeanne64
14 years agoOccasional Contributor
Alex,
I tried implementing the code you provided but it failed to work... The issue is that the cascading menu gets created at run time, and there is no real ID associated with the Actions "parent" menu item.
I have included an example of how the cascading menu is created.
** This is After a user has selected the item "Actions" from the parent menu. From there the cascading menu is created like so:
(MF_STRING, ID__SAMPDELSAMPLE, "Delete Samples");
//here is where the dynamic Actions menu comes in
//I've simplified this a bit from our actual code, but it does practically the same thing
//the menu is built (this is dynamic in our code, it loads the actions from the DB)
l_actionsmenu.CreatePopupMenu();
l_actionsmenu.AppendMenu(MF_STRING | MF_ENABLED, ACTIONS_MENU_OFFSET + 1, 'Create Sample');
l_actionsmenu.AppendMenu(MF_STRING | MF_ENABLED, ACTIONS_MENU_OFFSET + 2, 'Create Aliquot');
//then the cascading menu gets added as the Actions menu item
pPopup.AppendMenu(MF_STRING | MF_POPUP, (UINT)l_actionsmenu.m_hMenu, "Actions");
//then this command shows the menu
li_return = pPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, mouse_point.x, mouse_point.y, this);
//then li_return is evaluated and the Scan Mode dialog is shown when it determines what action was run
I tried implementing the code you provided but it failed to work... The issue is that the cascading menu gets created at run time, and there is no real ID associated with the Actions "parent" menu item.
I have included an example of how the cascading menu is created.
** This is After a user has selected the item "Actions" from the parent menu. From there the cascading menu is created like so:
(MF_STRING, ID__SAMPDELSAMPLE, "Delete Samples");
//here is where the dynamic Actions menu comes in
//I've simplified this a bit from our actual code, but it does practically the same thing
//the menu is built (this is dynamic in our code, it loads the actions from the DB)
l_actionsmenu.CreatePopupMenu();
l_actionsmenu.AppendMenu(MF_STRING | MF_ENABLED, ACTIONS_MENU_OFFSET + 1, 'Create Sample');
l_actionsmenu.AppendMenu(MF_STRING | MF_ENABLED, ACTIONS_MENU_OFFSET + 2, 'Create Aliquot');
//then the cascading menu gets added as the Actions menu item
pPopup.AppendMenu(MF_STRING | MF_POPUP, (UINT)l_actionsmenu.m_hMenu, "Actions");
//then this command shows the menu
li_return = pPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, mouse_point.x, mouse_point.y, this);
//then li_return is evaluated and the Scan Mode dialog is shown when it determines what action was run