Link to home
Start Free TrialLog in
Avatar of marisademeglio
marisademeglio

asked on

which popup menu was selected?

Hi experts,

I am trapping the OnMenuSelect event and, when the user has clicked a popup menu, I need to know which one.  There are nested popups in my app and the index value is not enough to tell which one has been selected, because I don't know which level the user is at.  Is there a way to find this out?

Thanks
Marisa
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marisademeglio
marisademeglio

ASKER

why is WM_INITMENUPOPUP better?
WM_INITMENUPOPUP:-

It is better because it contains the CMenu* pPopupMenu-directly popup menu and the index of it in mainmenu.
The framework calls this member function when a pop-up menu is about to become active.

WM_MENUSELECT:
OnMenuSelect is called by the framework when the user selects a menu item.
u NEED TO RETREIVE THE POPUPMENU AGAIN using the index and hSysMenu.


U can always find out which popupmenu  user clicked because
Letus assume
1)MainMenu(1st index)-Popupmenu-1 st level

2)Popupmenu(2nd index)-Popupmenu1-2nd level.

3)-Popupmenu1(3rd index)--Popupmenu2-3rd level.


a)here the relation is MainMenu is like parent for Popupmenu
b))Popupmenu is like parent for Popupmenu1 so on.

As the relations are clear it should be easy to identify which popup menu user has  clicked by these
relations.

hope this will help u.





In the context of this question, OnInitMenuPopup has no advantage over OnMenuSelect, because questioner needs to add some actions when menu items are highlighted. This should be done in OnMenuSelect, but there is problem with popup menus. Of course, it is possible to do this in OnInitMenuPopup and even in ON_UPDATE_UI message handler, but it is better to implement this feature in one function.
I think that is the reason I specified how the relations between popup menus and mainmenu's exist so that it will become easy to identify the popup menu user has selected.