Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I have a Menu Item CHECKED? ? ? ? 1

Status
Not open for further replies.

FORAND

Programmer
May 26, 2003
64
CA


Hi.

I'm building a menu here, and i can't seem to dynamicly change the CHECKED status of an Menu Item...

i know... newbe question. But i've been at it for an hour, and i can't find any example on the internet...


Thanks!

Pierre
 
You need to create a handler for the command update message for that menu item and set the checked value in there.

-pete
 
Sure but of course you know there are many on msdn.microsoft.com right?
Code:
afx_msg void OnUpdateRequestSendxml(CCmdUI* pCmdUI);


ON_UPDATE_COMMAND_UI(ID_REQUEST_SENDXML, OnUpdateRequestSendxml)

void Doc::OnUpdateRequestSendxml(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable();
	pCmdUI->SetCheck( _bSendXml);
}

-pete
 
Code:
void CSIFARSDlg::OnUpdateSupervision(CCmdUI* pCmdUI) 
{
    pCmdUI->Enable();
    pCmdUI->SetCheck(1);
}

Does'nt work... the item don't check...
Is there anything else I need to do ??? ?
 
>> CSIFARSDlg

I assume then that is a CDialog based class and that the application is not a Document/View project type?

CDialog does not implement the OnInitMenuPopup() so you need to do it yourself. Here is a MSDN article that provides the implementation details.


-pete
 
Thanks! This will help me a lot :eek:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top