Can't get a menu item to gray - Programmer

This is a discussion on Can't get a menu item to gray - Programmer ; Gauging by my questions, it should be apparent that I'm somewhat of a novice, but... In an SDI app, I have menu commands with associated toolbar buttons that refuse to gray. I retrieve the menu from the m_pMainWnd pointer and ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Can't get a menu item to gray

  1. Can't get a menu item to gray

    Gauging by my questions, it should be apparent that I'm somewhat of a
    novice, but...

    In an SDI app, I have menu commands with associated toolbar buttons
    that refuse to gray. I retrieve the menu from the m_pMainWnd pointer
    and it is valid because checking menu items works. Graying them,
    however, seems to have no effect. What am I missing?

    The basic method I use is:

    menu->EnableMenuItem( ID_MENU_ITEM, MF_BYCOMMAND | ( X ? MF_ENABLED :
    MF_GRAYED ) );

    ....where X, of course, yields a boolean result.

    Does this have something to do with the toolbar or the SDI framework?

  2. Re: Can't get a menu item to gray

    hi,

    try setting m_bAutoMenuEnable = false ; in your CMainFrame
    constructor. Otherwise - which is default - you have to use
    ON_UPDATE_COMMAND_UI handlers for changing states of menu items, because the
    menu-popup-windows were built just before they were displayed.

    greets
    Mark



+ Reply to Thread