Click here to Skip to main content
15,893,381 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralIDE Error/Problem I Think Pin
sweep1235-Aug-04 0:04
sweep1235-Aug-04 0:04 
GeneralRe: IDE Error/Problem I Think Pin
Cedric Moonen5-Aug-04 1:33
Cedric Moonen5-Aug-04 1:33 
GeneralRe: IDE Error/Problem I Think Pin
V.5-Aug-04 2:23
professionalV.5-Aug-04 2:23 
GeneralRe: IDE Error/Problem I Think Pin
David Crow5-Aug-04 2:36
David Crow5-Aug-04 2:36 
GeneralRe: IDE Error/Problem I Think Pin
sweep1235-Aug-04 2:40
sweep1235-Aug-04 2:40 
GeneralCVS dir comparer algo. Pin
Anthony_Yio5-Aug-04 0:02
Anthony_Yio5-Aug-04 0:02 
GeneralSDL1009 error while using Java Webservice from .NET 2003 Pin
arun14054-Aug-04 23:58
arun14054-Aug-04 23:58 
Generali can disable menu item but cannot gray it!!!!!!!! Pin
caykahve4-Aug-04 23:06
caykahve4-Aug-04 23:06 
Hi,

I have a dialog based app, want to disable and gray a sub menu item and I cannot gray it. I tried to find a solution to this problem but could not. Neither of the following work. Mad | :mad: What happens is I see Item 3 in black, press it, and nothing happens. I could have done it by modifying the code that is called when Item 3 is pressed. Why would I bother with OnUpdate? What's the use of it? I got no idea! Confused | :confused:

I will be very happy if someone can help me.

Thanks...

// The menu looks like:<br />
// File  Settings<br />
// Item1 Item2<br />
//       Item3


void CMyDlg::OnUpdateSettingsItem3(CCmdUI* pCmdUI) 
{
 if (pCmdUI->m_nID==ID_SETTINGS_ITEM3)
 {
    UINT fGray = Item3Enable ? 0 : MF_GRAYED|MF_DISABLED;
    if(pCmdUI->m_pMenu!=NULL)
       pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex /*ID_SETTINGS_ITEM3*/, MF_BYPOSITION|fGray);	
 }
 pCmdUI->Enable(Item3Enable);
}


void CMyDlg::OnUpdateSettingsItem3(CCmdUI* pCmdUI) 
{
 if (pCmdUI->m_nID==ID_SETTINGS_ITEM3)
 {
    UINT fGray = Item3Enable ? 0 : MF_GRAYED|MF_DISABLED;

    CMenu *hMenu;
    hMenu = AfxGetMainWnd()->GetMenu();		
    CMenu *sub;
    sub = hMenu->GetSubMenu(1);
    sub->EnableMenuItem(ID_SETTINGS_ITEM3, MF_BYPOSITION|fGray); }
 }
 pCmdUI->Enable(Item3Enable);
}

GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
Brian Delahunty4-Aug-04 23:15
Brian Delahunty4-Aug-04 23:15 
GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
caykahve4-Aug-04 23:27
caykahve4-Aug-04 23:27 
GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
Jaime Stuardo5-Aug-04 3:39
Jaime Stuardo5-Aug-04 3:39 
GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
caykahve5-Aug-04 4:35
caykahve5-Aug-04 4:35 
GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
Jaime Stuardo5-Aug-04 5:03
Jaime Stuardo5-Aug-04 5:03 
GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
caykahve5-Aug-04 5:27
caykahve5-Aug-04 5:27 
GeneralRe: i can disable menu item but cannot gray it!!!!!!!! Pin
Jaime Stuardo5-Aug-04 6:06
Jaime Stuardo5-Aug-04 6:06 
Generalsolution! Pin
caykahve6-Aug-04 0:25
caykahve6-Aug-04 0:25 
QuestionHow to hide dialog box in MFC Pin
Rajesh_K_Sharma4-Aug-04 22:55
Rajesh_K_Sharma4-Aug-04 22:55 
AnswerRe: How to hide dialog box in MFC Pin
Brian Delahunty4-Aug-04 23:07
Brian Delahunty4-Aug-04 23:07 
GeneralRe: How to hide dialog box in MFC Pin
Rajesh_K_Sharma5-Aug-04 0:47
Rajesh_K_Sharma5-Aug-04 0:47 
GeneralRe: How to hide dialog box in MFC Pin
David Crow5-Aug-04 2:39
David Crow5-Aug-04 2:39 
QuestionDSW file format? Pin
Member 12782624-Aug-04 22:45
Member 12782624-Aug-04 22:45 
AnswerRe: DSW file format? Pin
David Crow5-Aug-04 2:42
David Crow5-Aug-04 2:42 
GeneralRe: DSW file format? Pin
Member 12782625-Aug-04 3:08
Member 12782625-Aug-04 3:08 
QuestionHow to write Custom GINA.dll Pin
anshums4-Aug-04 22:27
anshums4-Aug-04 22:27 
GeneralHai Pin
Asha Rams4-Aug-04 22:18
Asha Rams4-Aug-04 22:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.