Click here to Skip to main content
15,920,383 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//Visual Studio 2008 sp 1

when I use GetContextMenuManager()->ShowPopupMenu(), it avoid submenu's uistate.

//ShowPopupMenu(HMENU hmenuPopup, int x, int y, CWnd* pWndOwner, BOOL bOwnMessage = FALSE, BOOL bAutoDestroy = TRUE, BOOL bRightAlign = FALSE);

Example source code

CMenu menu1, menu2;
menu.CreatePopupMenu();

menu1.AppendMenu( MF_STRING | MF_CHECKED, WM_USER+1, _T("A") );
menu2.AppendMenu( MF_STRING | MF_CHECKED, WM_USER+2, _T("SubMenu A") );

menu1.AppendMenu( MF_BYCOMMAND | MF_STRING | MF_POPUP, reinterpret_cast<uint_ptr>(menu2.Detach()), _T("Submenu") );

theApp.GetContextMenuManager()->ShowPopupMenu(menu1.Detach(), x, y, this, TRUE, TRUE);


when it appeared, the menu "A" is checked, but SubMenu A wasn't.

isn't there anyone know why?
Posted

The function
C++
void CMFCToolBarMenuButton::CreateFromMenu(HMENU hMenu)

does produce a submenu, but does not control the checked state inside...

You could insert your buttons directly (it's easy),
or reaccess some buttons after the creating of presented kind :)
 
Share this answer
 
//Eugen Podsypalnikov
Thanks. : )

In fact, i know it there no the process that for submenu's uistate.
Actually, what i want to know is why they made it like this? I fell that it's some kind of bug..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900