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 |
|
Alex Shugai
|
Sep 20, 2006 - 10:12 PM
|
If I load a menu to CExtButton mButton: CMenu _menu; _menu.LoadMenu(menuID) ... do something to modify/add menu items mButton->m_menu.Attach(_menu.Detach());
The menu works fine except the ownerdraw code doesn’t draw the menu check marks. is there a way to make the menu checks visible?
|
|
Technical Support
|
Sep 21, 2006 - 11:28 AM
|
What the ownerdrawn code you mean? The CPagePopupMenus::OnDrawPopupMenuItem() method of the ProfUIS_Controls sample handles the CExtPopupMenuWnd::g_nMsgPopupDrawItem registered windows message and repaints the command item identified with ID_OWNERDRAW_ITEM in the context menu on the "Popup Menus" dialog. If this is not what you mean please, please clarify the issue.
|
|
Alex Shugai
|
Sep 21, 2006 - 3:43 PM
|
I mean that if I create a menu resource with checked items and then load it to CExtButton m_menu member the ProfUUIS ownerdraw code doesnot draw the checkmarks! I need to be able to draw check marks at run-time and as far as I can see from you samples there is no code for this.
|
|
Technical Support
|
Sep 22, 2006 - 12:46 PM
|
Each menu/toolbar item controls its status (enabled/disabled, checked/unchecked) via MFC command updating mechanism. So, you can make a menu item checked by providing an update handler for the command ID (simply add the ON_UPDATE_COMMAND_UI handler for this command): afx_msg void OnUpdateYourCommand(CCmdUI* pCmdUI);
...
ON_UPDATE_COMMAND_UI(ID_YOUR_COMMAND, OnUpdateYourCommand)
...
void CMainFrame::OnUpdateYourCommand( CCmdUI * pCmdUI )
{
pCmdUI->SetCheck( m_bChecked ? 1 : 0 );
}
|
|