|
-
October 25th, 1999, 09:55 PM
#1
How do I Enable/Disable Menu Items on a MDI
I am having trouble getting the EnableMenuItem function to work properly in either a SDI or MDI application. Basically, I am doing a
GetMenu()->EnableMenuItem( ID_MENU_ITEM, MF_GRAYED )
This works fine in a dialog project, but in a SDI or MDI project, it does not work at all. The functions seem to execute properly, but the menu items do not gray out. Its certainly possible I could just not be placing it in the right place, but I have tried everywhere I can think of. Any help would be appreciated. Please email me at [email protected].
-
October 25th, 1999, 10:14 PM
#2
Re: How do I Enable/Disable Menu Items on a MDI
Ok, I just found a way to make it work. All I had to do was set the m_bAutoMenuEnable member variable of the CFrameWnd object to false. This made the
GetMenu()->EnableMenuItem( ID_MENU_ITEM, MF_GRAYED );
work properly. If there are other methods please let me know.
Thanks.
-
October 26th, 1999, 02:02 AM
#3
Re: How do I Enable/Disable Menu Items on a MDI
You can add an update message to your menu item with ClassWizard
And the update function is like:
[ccode]
void CDialog::OnUpdateMenuItem(CCmdUI* pCmdUI)
{
if ( condition )
pCmdUI->Enable(TRUE); // Condition TRUE, the menu item is enable
else
pCmdUI->Enable(FALSE); // else, it is disabled
}
HTH
Sandrine
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
|