none
disabling items on a popup menu RRS feed

  • Question

  • Hi

    I am trying to gray items on a popup menu at run time.

    I used the following statement.

    file_menu->EnableMenuItem(ID_CONTACTS_PH1_PAGER, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);

    But this is not working.

    I have no clue why this wont work. Coz it seems perfectly fine to me. Any suggestions anybody?

    Regards
    Sharat
    Wednesday, August 10, 2005 6:47 AM

Answers

  • Hi Sharat,

    Did you set the CMainFrame class' m_bAutoMenuEnable member to FALSE (the constructor is the place to do this)?  If you don't do this, MFC's automatic command UI updating will override your EnableMenuItem call just before a popup menu is shown.

    Hope this helps,

    -Ron Pihlgren
     VC++ Testing
    Wednesday, August 10, 2005 7:19 AM