Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » ItemData to MenuItem Collapse All
Subject Author Date
Offer Har Sep 13, 2006 - 1:01 PM

Dear Support,

I have a popup menu that i build dynamically.
I use ON_COMMAND_RANGE macro to get the item clicked in the menu.
I need to attach to each menu item an ItemData, so that when i get a menu command i will know what to do with the command.
I saw that CExtPopupMenuWnd::MENUITEMDATA has a m_nLParam variable - is it free for my use, or does it have another use.

Regards,

Offer

Technical Support Sep 14, 2006 - 10:16 AM

Yes, you can use LPARAM of each menu item for whatever you want. But it is convenient only when you are coding some kind of custom menu based on the CExtPopupMenuWnd-derived class. The WM_COMMAND message handlers both for one command and for command range do not allow you to know whether the command is invoked from the toolbar or from the menu. So, we recommend you keep the array of data objects related to dynamic menu items as the property of the class which creates dynamic menu commands and handles them.

Offer Har Sep 14, 2006 - 10:19 AM

You are correct.

Another think is that a popup menu is destroyed by the time the command is called, so i couldn’t get the LPARAM of it.
I ended up doing just what you suggested...