CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Menu Question

  1. #1
    Join Date
    May 1999
    Posts
    57

    Menu Question

    How can grey or hide a menu itemt hat has a sub menu at runtime? When a menu is set as pop-up (so that it has a submenu) the id combo box gets disabled.



  2. #2
    Guest

    Re: Menu Question

    Use the MF_BYPOSITION flag when calling EnableMenuItem. See the following code fragment.

    void CMainFrame::OnInitMenu(CMenu* pMenu)
    {
    CMDIFrameWnd::OnInitMenu(pMenu);
    CMenu* pSubMenu=pMenu->GetSubMenu(2);
    pSubMenu->EnableMenuItem(0,MF_BYPOSITION|MF_GRAYED);
    }



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured