|
-
June 21st, 2005, 10:58 AM
#16
Re: Problem with owner draw menu's and appendMenu
You may only have an HMENU at the time in the CMenuBar but you should be able to convert it to a CNewMenu like this:
Code:
CNewMenu menu;
menu.Attach(hMenu);
// use CNewMenu get menu string function
menu.Detach(); // so CMenu doesnt try and destory the menu resource
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
-
June 21st, 2005, 11:02 AM
#17
Re: Problem with owner draw menu's and appendMenu
Oh, and one other thing whilse it occurs to me.
You could modify the CNewMenu append function(s) to set the menu string in the HMENU text so GetMenuItemInfo() would return the ocrrect text.
You can do this after the regular append by making use of ModifyMenu() which you should be able to use to just set the menu item text.
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
-
June 22nd, 2005, 03:27 AM
#18
Re: Problem with owner draw menu's and appendMenu
 Originally Posted by Roger Allen
You may only have an HMENU at the time in the CMenuBar but you should be able to convert it to a CNewMenu like this:
Code:
CNewMenu menu;
menu.Attach(hMenu);
// use CNewMenu get menu string function
menu.Detach(); // so CMenu doesnt try and destory the menu resource
This is what I did. I saved the old HMenu and used it with CNewMenu::GetMenuString().
Thanks alot for all your patience and help, Roger. Without that I would have stopped using guitoolkit some time ago.
So this problem is solved.
Although the next problem is that now MeasureItem functions are used. Since CNewMenu and CMenuBar are implemented with different styles, the submenus are shown, but have another style than the upper level menuitems :s. When a resource menu is loaded, the MeasureItem functions were not used it seems and all is drawn in the styles of CMenuBar - because the buttons are CGuiMenuButtons. When a menu is modified, CNewMenu: rawItem() draws the menuitems.
Seems to be a new challenge for me to spend some time on :-(
-
January 13th, 2006, 08:03 AM
#19
Re: Problem with owner draw menu's and appendMenu
hi
i used Guitoolkit too,
now ,i want to dynamic create menu in CMainFrm, but i can't successed.
void CMainFrame::AddMenu()
{
CNewMenu MainMenu;
MainMenu.Attach( m_wndMenuBar.m_hMenu );
CNewMenu DllMenu ;
DllMenu.CreatePopupMenu();
DllMenu.AppendMenu(MF_POPUP|MF_OWNERDRAW,0x9498,"dddd");
DllMenu.AppendMenu(MF_POPUP|MF_OWNERDRAW,0x9397,"ddaf");
MainMenu.AppendMenu(MF_POPUP|MF_OWNERDRAW,(UINT)(DllMenu.Detach()),"Append Menu");
MainMenu.Detach();
this->DrawMenuBar();
}
i could cause assert error!
why?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|