Originally posted by: Mark Seuffert
Hi,
I would like to make a bitmaped (context) menu in a CDialog window. Any hints would help, thanks!
Originally posted by: Kevin Davis
If I have a menu with duplicate accelerator keys
Example
&New
&Open
&Print
&Print Preview
Using the Cool Menu does not function like the normal windows menu. With the normal windows menu if I hit "P" with this menu open the menu would alternate between selecting Print and Print Preview. Then I would hit return when the menu I wanted was selected. In BCMenu if I hit "P" print will be selected and run. Any ideas how to deal with duplicate mnemonics?
Originally posted by: Leonid Prokopovich
The buggy code:
OnCreate()
{
...
//Toolbar and other stuff creation skipped
...
m_menu.DestroyMenu();
m_menu.LoadMenu( ID_MY_LOVELY_MENU ); // <--- BANG!!!
...
}
When trying to change menu in CFrameWnd::OnCreate() via BCMenu::LoadMenu( UINT nMenuResID ) the program asserted in
BCMenu::InsertSpaces. The reason of crash was that AfxGetMainWnd() returned NULL because the window was created but TLS entry for window handle IMHO is updated after the OnCreate() call.
I think that it was better to rewrite BCMenu code and add an initialization function that will receive this missing handle.
Originally posted by: Vasya
I received the zipped executable this time fine
and the problem I was having earlier wasn't there in your
exe. So I went back to the site downloaded the class again
and everything works great and looks great. Thank you so much.
I greatly appreciate your help.
Vasya
ReplyOriginally posted by: Vasya
Hi Brent,
Regarding the blurred text appreance of disabled
items, the example you sent me has bunch of Java files.
But I could not see any exe's. it doesnot even have C++
files. I am using VC6.0 with service pack 3.
I would really appreciste if you could send me the
example again....
Thanks alot.
Vasya
ReplyOriginally posted by: vasya
When a disabled menu item is selected the item's text
is shown with glare and the other problem is menu items
on popup menu canot be disabled.
Originally posted by: Roger Allen
Brent,
I have used your BCMenu class with much success, but recently, in a an application using many DLL's which supply their own menu items, I can successfully add the menu items and bitmaps to the menu but the bitmaps only work correctly as long as the menu item is enabled.
When the menu item is disabled and you go to display the item, the BCmenu looks to see if it has the grayed icon version of the bitmap, but it doesn't yet exist. It then trys to load it from the local resources, but the .exe file doesn't have this resource! You get an assertion error, which I have currently put a fix in to avoid, so we end up with no grey icon displayed.
Is it possible that if the BCMenu cannot find the bitmap for the grey icon locally that it can generate it from the one used to display the enabled bitmap? I tried looking into the code for this, but it looks very compilcated, and my attempts to get the right bitmap all failed.
Here is the code I use to add the menu items and bitmaps to the menu :
// get the menu name that this option needs to be added to
CString dll_menu_name = refineDLL[i].DLLMenuPutIn(menuID) ;
CString our_menu_name = "" ;
// look for the menu in the m_menu
int num_items = pMainFrame->m_menu.GetMenuItemCount() ;
int sub_menu ;
// look for the correct sub menu to add this item to
for (sub_menu = 0 ; sub_menu < num_items ; sub_menu++)
{
pMainFrame->m_menu.GetMenuString(sub_menu, our_menu_name, MF_BYPOSITION) ;
if (our_menu_name == dll_menu_name)
break ;
}
if (sub_menu != num_items)
{
// sub menu name found in the m_menu, add
((BCMenu*)(pMainFrame->m_menu.GetSubMenu(sub_menu)))->AppendODMenuA(name, MF_OWNERDRAW, REFINESCRIPT_MENU_START_ID+j);
// load the bitmap for the menu icon
CBitmap btmMenuIcon;
if (refineDLL[i].DLLMenuIcon != NULL && refineDLL[i].DLLMenuIcon(menuID, &btmMenuIcon))
{
// bitmap supplied, so use bitmap
pMainFrame->m_menu.ModifyODMenuA(name, REFINESCRIPT_MENU_START_ID+j, &btmMenuIcon);
// delete bitmap object
btmMenuIcon.DeleteObject();
}
}
I did this using an earlier version of BCMenu, I will try it also with V2.61!
Yours,
Roger Allen
Sirius Analytical Instruments
Originally posted by: Brent Corkum
Version 2.61 is now available on my website:
http://www.rocscience.com/~corkum/BCMenu.html
Brent
ReplyOriginally posted by: Christian
How do I get this to work when there are more than one document type and when all of them has different menues (resources).
Originally posted by: Why Zhang
I want to create a popup menu whose menuitems are image(or ownerdraw) without text when sending TOOLBARDROPDOWN message, like selecting the Line mode in Ms Word.
I have failed some times. The ownerdraw menuitems can't be
shown.
Who can help you? Better give me a example?
SOS!
Reply