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

    How to capture mouse scroll for the CMFCRibbonEdit class?

    For a ribbon bar with edit controls (CMFCRibbonEdit) I want to handle the mouse scroll events for the edit controls. That is, when the user clicks and then scrolls on the edit it will navigate a predefined list of strings. I want to capture the scroll event in order to update the edit text step by step.
    This kind of behavior is implemented by the Spin Edit; I don't want to use the spin edit control since it only uses a list of integers and the spin buttons are too small.
    Is there a way to catch the mouse scroll event for the CMFCRibbonEdit control? Please give some hints on how to approach message handling for the ribbon (other messages than the COMMAND allowed by the ribbon designer). I'm using VS2010 on Windows 7 and the ribbon was designed with the ribbon designer.
    Thank you,
    Cristi.

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

    Re: How to capture mouse scroll for the CMFCRibbonEdit class?

    Perhaps you will find some ideas from this discussion.
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: How to capture mouse scroll for the CMFCRibbonEdit class?

    given your description, you probably don't want to use an editcontrol with custom stuff added on top, but rather, you probably want an editable combobox which does everything you want (and more).

  4. #4
    Join Date
    Jan 2013
    Posts
    6

    Re: How to capture mouse scroll for the CMFCRibbonEdit class?

    Thank you for the link Victor. It mentions subclassing the edit window in order to handle all messages. Now, the CMFCRibbonEdit class contains a protected pointer to a rich edit control which, apparently, I have to replace. That seems to be the (twisted and undocumented) way to go...

    OReubens, please be more specific - which class do you have in mind or suggest for this task?
    I've checked the CMFCRibbonComboBox class, derived from CMFCRibbonEdit, but it has no method related to the mouse wheel message.
    Or, should I go with a spin edit and try to change its appearance?
    Last edited by Cristi; October 20th, 2014 at 12:42 PM.

  5. #5
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: How to capture mouse scroll for the CMFCRibbonEdit class?

    You're looking at it the wrong way. Don't abuse controls into doing things they aren't designed for.

    For one, you'll typically have a hard time enforcing your will onto how the creators intended things to be used.
    Secondly, your users will be confronted with controls and/or behaviour they're not used to, so they'll find your application "weird" and "awkward to use".
    And finally your hard efforts may be totally thwarted when a new version of the controls is made and things suddenly stop working.


    What you want is an editable combobox with all it's associated behaviour and methods to interact with it, rather than insisting things happen "your way".


    -> Spin controls are intended for increasing/decreasing numeric values, not to 'spin through a list of strings'.

Tags for this Thread

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