CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    May 2008
    Posts
    70

    No replacement of Main menu bar

    In my MDI application,I want the main menu bar not to be replaced with the child menubar.When a child frame is opened from the mainmenu item, the additional menu items from the childmenu bar to be shifted to the main menu bar. Is it possible? If yes, Please Help
    regards

  2. #2
    Join Date
    Jun 2005
    Posts
    1,255

    Smile Re: No replacement of Main menu bar

    Change your MDI application into an SDI application having several child windows. This will be easier than to customize MDI menus.

  3. #3
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    Already 90% of my project is complete,so please help
    regards

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: No replacement of Main menu bar

    Quote Originally Posted by Plaban
    In my MDI application,I want the main menu bar not to be replaced with the child menubar.When a child frame is opened from the mainmenu item, the additional menu items from the childmenu bar to be shifted to the main menu bar. Is it possible? If yes, Please Help
    regards
    What's the point in doing it that way?

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: No replacement of Main menu bar

    Quote Originally Posted by Plaban
    ... When a child frame is opened from the mainmenu item, the additional menu items from the childmenu bar to be shifted to the main menu bar. Is it possible?
    Of course it is posiible!
    But it cannon be done "magically". You will have to write code to do it:
    get old menu
    remove all items you don't need
    load new (child frame) menu
    enum its subitem, get subitem data and move to the "old" menu
    destroy the old menu
    set a new cretated/updated menu
    redraw rhe menu bar
    And this process you will need to run every time you activate another document or frame.
    So the main question is: why not to let the Framework replace your menus?
    Victor Nijegorodov

  6. #6
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    In the call to my child frame handler function, if I set to the main menu, it works but the problem is that after opening to the multiple child window,if I switch to any window,from the opened windows,then the main menu bar gets replaced with the child menu bar. Where should I set the menu,so that the main menu doesn't gets replaced even when switching to different open windows .
    regards

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

  8. #8
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    Does CDocument::GetDefaultMenu() is a member function of CDocument?If yes,how to access it.
    regards

  9. #9
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    It is written in the tutorial about CMDIChildWnd::m_hMenuShared Data member,but I am not getting data member for this class or any other base classes. Please help
    regards

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: No replacement of Main menu bar

    Quote Originally Posted by Plaban
    It is written in the tutorial about CMDIChildWnd::m_hMenuShared Data member,but I am not getting data member for this class or any other base classes.
    Define "am not getting data member".
    Have you tried to just copy/paste the code from "How to Use Multiple Menus in MFC App That Uses GetDefaultMenu" article? Doesn't it complile? Doesn't it work?

    And BTW, the code sample from "INFO: Sharing Menus Between MDI Child Windows" allow you to use the same menu for all your documents! It is exactly what you asked:
    Quote Originally Posted by Plaban
    Where should I set the menu,so that the main menu doesn't gets replaced even when switching to different open windows .
    Victor Nijegorodov

  11. #11
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    Yes, "Sharing Menus Between MDI Child Windows" is the answer to my Question. But the problem is that my Menu bar contains Navigational menu items and if I open multiple MDI child windows,after closing the last opened window, the Navigational menu items of the present active window does not works. And one more question few data members as m_hMenuShared of class CMultiDocTemplate given in the "Sharing Menus Between MDI Child Windows" is not present, but still it works after I wrote the code.Why and how to get these members?
    regards

  12. #12
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: No replacement of Main menu bar

    What is "Navigational menu items"?

    Quote Originally Posted by Plaban
    ... few data members as m_hMenuShared of class CMultiDocTemplate given in the "Sharing Menus Between MDI Child Windows" is not present, but still it works after I wrote the code.Why and how to get these members?

    If "it works" then all these data members are present. However, some of them might be undocumented, therefore not visibile in the intellisense...
    Victor Nijegorodov

  13. #13
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    Quote Originally Posted by VictorN
    What is "Navigational menu items"?
    Navigational menu items means like moving to next record with the help of CRecordSet::MoveNext ,CRecordSet::MoveFirst... These menu items does not works.
    regards

  14. #14
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: No replacement of Main menu bar

    In what class do you handle CRecordSet::MoveNext ,CRecordSet::MoveFirst... actions?
    Victor Nijegorodov

  15. #15
    Join Date
    May 2008
    Posts
    70

    Re: No replacement of Main menu bar

    Quote Originally Posted by VictorN
    In what class do you handle CRecordSet::MoveNext ,CRecordSet::MoveFirst... actions?
    In their CRecordView derived classes of the respective views.

Page 1 of 2 12 LastLast

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