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
    156

    How to programmatically hide a main menu item

    Hi gurus,

    Can someone tell me how to 'Hide' and 'Show' a main menu item, in respsonse to a user selection of some other option. The main item was created with the Resource Editor. I want to make one of the main menu items (and all its submenu items) disappears for some operation mode.

    I have posted this Q before but no joy. Please advise.


    Will


  2. #2
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: How to programmatically hide a main menu item

    One method is to define two menus - the main one which has everything, and the other which mirrors the first but removes the required menu item from the top level; you can then use the SetMenu method to use the new menu. However, this interferes with the MFC framework use of menus (i.e., when a document is open there is a view-type menu in place of the main menu), and of course, if you wanted to hide different top-level menus for different situations you would have to define multiple menus.

    A second method is to have all the menu items which you want to be able to dynamically show or hide as popups from one permanent top-level menu - for example, the permanent menu could be called Functions and the popups within that menu could be Sin, Cos and Tan and could be shown or hidden at will. This approach is slightly more complicated, but does not interfere with the MFC framework.

    If these approaches are no good, e-mail me at [email protected] and I'll see if I can magic up something else.



    --
    Jason Teagle
    [email protected]

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