Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Why CButton-derived class with BS_GROUPBOX style doesn't get messages?

Why CButton-derived class with BS_GROUPBOX style doesn't get messages?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yaumen
    wrote on last edited by
    #1

    Hi I try to create my own GroupBox (CButton class with BS_GROUPBOX style) control but that class doesn't get any messages from the mouse: WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_LBUTTONUP and etc. I can't understand why. Can anyone help me?

    L J 2 Replies Last reply
    0
    • Y Yaumen

      Hi I try to create my own GroupBox (CButton class with BS_GROUPBOX style) control but that class doesn't get any messages from the mouse: WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_LBUTTONUP and etc. I can't understand why. Can anyone help me?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Have you added a message map to your class, as described in https://msdn.microsoft.com/en-us/library/yf1wax6c.aspx[^]?

      Y 1 Reply Last reply
      0
      • L Lost User

        Have you added a message map to your class, as described in https://msdn.microsoft.com/en-us/library/yf1wax6c.aspx[^]?

        Y Offline
        Y Offline
        Yaumen
        wrote on last edited by
        #3

        I added to .h afx_msg void OnMouseMove(UINT nFlags, CPoint point); and to .cpp ON_WM_MOUSEMOVE() ... void CMyGroupBox::OnMouseMove(UINT nFlags, CPoint point) { } That works for simple CButton-derived class but with BS_GROUPBOX style it's not work

        1 Reply Last reply
        0
        • Y Yaumen

          Hi I try to create my own GroupBox (CButton class with BS_GROUPBOX style) control but that class doesn't get any messages from the mouse: WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_LBUTTONUP and etc. I can't understand why. Can anyone help me?

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          A group box is by design not intended to handle mouse messages but passes them through. You might have a look at this StackOverflow thread which seems to provide a solution: http://stackoverflow.com/questions/2541714/adding-click-double-click-events-to-static-group-box-controls[^]

          Y 1 Reply Last reply
          0
          • J Jochen Arndt

            A group box is by design not intended to handle mouse messages but passes them through. You might have a look at this StackOverflow thread which seems to provide a solution: http://stackoverflow.com/questions/2541714/adding-click-double-click-events-to-static-group-box-controls[^]

            Y Offline
            Y Offline
            Yaumen
            wrote on last edited by
            #5

            Thanks a lot The way with WM_NCHITTEST handler works!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups