|
|
|
|
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.
Subject |
Author |
Date |
|
Alastair Watts
|
Jul 12, 2011 - 2:26 AM
|
Is it possible to set an image for the popup elements of a CMenu?
|
|
Alastair Watts
|
Jul 19, 2011 - 10:38 AM
|
|
|
Alastair Watts
|
Jul 15, 2011 - 11:35 AM
|
OK ... I’ve read the link you sent & still don’t get it! I’ve got a dialog with a toolbar. The toolbar has a button menu with sub menus which is set using: CMenu mnu; mnu.LoadMenu(IDR_FILE); m_wndToolbar.SetButtonMenu(m_wndToolbar.CommandToIndex(ID_FILE_24), mnu.Detach(), true, true, false); How do I set the icon for each of the sub-menus?
|
|
Technical Support
|
Jul 17, 2011 - 10:21 AM
|
The CExtPopupMenuWnd object is always created just before a menu should be displayed and always destroyed when a menu disappears. You cannot initialize menu items in a CExtPopupMenuWnd menu immediately after you invokes the m_wndToolbar.SetButtonMenu( . . . ) code. You should handle the CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel registered message in your main frame or dialog window (where a toolbar is created). This message is sent once before any popup menu level appears on the screen. It allows you to initialize any popup menu dynamically. You can add new menu items, remove or modify any existing ones.
|
|
Alastair Watts
|
Jul 14, 2011 - 3:51 AM
|
I currently use the following the set a button menu, how do I use a CExtPopupMenuWnd?
true, true, false); CMenu mnu; mnu.LoadMenu(IDR_FILE);
m_wndToolbar.SetButtonMenu(m_wndToolbar.CommandToIndex(ID_FILE_24), mnu.Detach(),
|
|
Technical Support
|
Jul 15, 2011 - 3:08 AM
|
|
|
Technical Support
|
Jul 13, 2011 - 9:11 AM
|
You can use CExtPopupMenuWnd::ItemSetPopupIcon() method.
|
|
Alastair Watts
|
Jul 12, 2011 - 2:20 PM
|
So can I set an image for a popup element (sub menu) ... it is not a command.
|
|
Technical Support
|
Jul 12, 2011 - 11:06 AM
|
By default, all menu items are based on CExtCmdItem command descriptions stored in the CExtCmdManager (g_CmdManager ). You can attach an icon to any command using its identifier. The CExtCmdIcon icon object can be attached using the CExtCmdManager::CmdSetIcon() API. A Prof-UIS popup menu also supports menu items which are not based on the command manager. Such menus are useful as context menus or item picker menus tracked with message loop and returning the clicked item identifier without sending WM_COMMAND . If you initialized menu items using CExtMenuWnd::ItemInsertCommand() API, then it’s not based on the command manager and not updated through MFC’s command updating mechanism.
|
|