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 » How to set Menu Icons for TrackPopupMenu() menus? Collapse All
Subject Author Date
Neville Franks Nov 26, 2003 - 1:03 AM

Hi,
I want to enable icons to be used for menu items for menus used via. TrackPopupMenu(). I understand that if a cmd id for a menu item matches a cmd id on the main toolbar, then its icon will be used. But how do I get icons displayed for other commands. ie. Commands that don’t have an associated toolbar button.

I tried creating a new a toolbar that is never displayed and setup a TOOLBAR resource, but the images aren’t displayed. Do I need to somehow specify that this Toolbar should be used instead of the IDR_MAINFRAME one for specific calls to TrackPopupMenu(). If so how? I don’t want to have to manually code setting icon’s for for each individual menu item.

Thanks.
Neville

Technical Support Nov 26, 2003 - 6:58 AM

Dear Neville,

Please verify you have done correctly the following two things:

1) You have invoked g_CmdManager->UpdateFromMenu( . . . , IDR_YOUR_POPUP_MENU )
2) You have invoked g_CmdManager->UpdateFromToolBar ( . . . , IDR_YOUR_TOOLBAR_FOR_POPUP )

After that, you may create a dynamic instance of the CExtPopupMenuWnd class, invoke its LoadMenu( HWND, IDR_YOUR_POPUP_MENU ) and TrackPopupMenu() methods. The displayed popup menu must have icons corresponding to the buttons in the IDR_YOUR_TOOLBAR_FOR_POPUP toolbar resource.

Neville Franks Nov 26, 2003 - 12:50 PM

Thanks. Adding g_CmdManager->UpdateFromToolBar ( . . . , IDR_YOUR_TOOLBAR_FOR_POPUP ) got things working.

However I didn’t add: g_CmdManager->UpdateFromMenu( . . . , IDR_YOUR_POPUP_MENU ). Do I realy nead to do this for dynamic menus?

Neville

Technical Support Nov 27, 2003 - 12:44 AM

Dear Neville,

We suppose you invokes g_CmdManager->UpdateFromMenu() for the IDR_MAINFRAME resource (or this method is invoked automatically during initialization of the menu bar). In this case, you do not need to call g_CmdManager->UpdateFromMenu(...,IDR_YOUR_POPUP_MENU) if all commands in the IDR_YOUR_POPUP_MENU menu are duplicated in IDR_MAINFRAME. Otherwise, you should.