CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    34

    Disable Menu-Items

    Disable Menu-Items

    Hi !

    I'm using a CMDIFrameWnd as main-window. My problem: I don't want to use the ON_UPDATE_COMMAND_UI-stuff, to do the enabling and disabling of the items of the menu in the framewindow. I want something like:

    Somewhere in the code, I want to say:

    menu->EnableMenuItem(command_id, MF_DISABLED);

    to disable an item.
    The problem is, that MFC overrides this states set somewhere in the programm. I tried to override OnInitMenu and OnInitPopupmenu, but it doesn't help.

    It's very important, that we can use this sort of command-handling. There is no other (easy) way to implement our programm. Please help !

    Regards

    Martin



  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: Disable Menu-Items

    MFC user-interface update command message handling is designed to use the ON_UPDATE_COMMAND_UI handlers. They are called during idle processing and WM_INITMENUPOPUP message handling. You will find it an uphill struggle to implement an alternative.

    It is possible to disable the default disabling of user-interface objects using CFrameWnd::m_bAutoMenuEnable flag, but this doesn't sound like what you want.

    As is usually the case with MFC, you need a very strong reason to go against its design intent, and a very detailed knowledge of its internals to make the alternative work.

    Why don't you want to use ON_UPDATE_COMMAND_UI handlers?

    Dave


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