CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2015
    Posts
    8

    Buttons from ribbon appear disabled

    Hello All,

    I would have one question: In VS2013, using the wizard, I have created a small MFC project that contain a ribbon. You already know that in this case VS create automatically several files (View, Doc, MainFrm, etc.). If I create the ribbon message map in one of these files that was created automatically the buttons from ribbon appear enabled, BUT if I create the message map in a class created manually by me, all buttons appear disabled. Why? I want that for each group of buttons of the ribbon to have a separate class. I can't put all methods of the buttons in a single class, it's not elegant.

    Thank you very much!

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

    Re: Buttons from ribbon appear disabled

    Quote Originally Posted by Isaak View Post
    ... I have created a small MFC project that contain a ribbon. You already know that in this case VS create automatically several files (View, Doc, MainFrm, etc.). If I create the ribbon message map in one of these files that was created automatically the buttons from ribbon appear enabled, BUT if I create the message map in a class created manually by me, all buttons appear disabled. ...
    How does your "class created manually" look like? Is it derived from CWnd? or some other class?
    What "ribbon" messages did you create?
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2015
    Posts
    8

    Re: Buttons from ribbon appear disabled

    Hi Victor, and Thanks for help.

    I have created a very simple example and attached to this email.
    So, I have created a new button on my ribbon, the I added an event-handler into a new class that was created by me. That new class is derived from CWnd.


    Thanks again,
    Best regards!
    Attached Files Attached Files

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

    Re: Buttons from ribbon appear disabled

    Your class MyCLASS is NOT used/invoked in your application. So how are you going to let this button work?
    Victor Nijegorodov

  5. #5
    Join Date
    Feb 2015
    Posts
    8

    Re: Buttons from ribbon appear disabled

    I understand what you mean, thank you, I made a stupid mistake.
    In your opinion, what is best method to "integrate" MyCLASS into project in order to make it functional?
    Last edited by Isaak; August 5th, 2016 at 03:19 PM.

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

    Re: Buttons from ribbon appear disabled

    I don't see any pros/advantages in your way to move the toolbar/ribbonbar buttons messages to "the message map in a class created manually".
    Note that in such a case you wil also need to rout all the ribbonbar buttons messages (including ON_COMMAND and ON_UPDATE_COMMAND_UI) to this class window manually! Otherwise your application won't work as expected!
    See also
    https://msdn.microsoft.com/en-us/library/xt2c310k.aspx
    https://support.microsoft.com/en-us/kb/97693
    https://social.msdn.microsoft.com/Fo...orum=vcgeneral
    Victor Nijegorodov

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