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. CButton click

CButton click

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 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.
  • G Offline
    G Offline
    goorley
    wrote on last edited by
    #1

    I have a CButton derived class. I would like this class to handle the click event itself. What should I put in my message map for the button class? ON_BN_CLICKED doesn't work. :confused:

    H C 2 Replies Last reply
    0
    • G goorley

      I have a CButton derived class. I would like this class to handle the click event itself. What should I put in my message map for the button class? ON_BN_CLICKED doesn't work. :confused:

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      ON_BN_CLICKED just wraps a WM_COMMAND message. You probably want to catch WM_LBUTTONUP messages.

      Best wishes, Hans


      [Hans Dietrich Software]

      1 Reply Last reply
      0
      • G goorley

        I have a CButton derived class. I would like this class to handle the click event itself. What should I put in my message map for the button class? ON_BN_CLICKED doesn't work. :confused:

        C Offline
        C Offline
        Cool_Dev
        wrote on last edited by
        #3

        goorley wrote:

        I would like this class to handle the click event itself.

        use ON_CONTROL_REFLECT() message map.

        BEGIN_MESSAGE_MAP(CMyBtn, CButton)
        ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
        END_MESSAGE_MAP()

        // CMyBtn derived from CButton
        void CMyBtn::OnClicked()
        {
        }

        TN062: Message Reflection for Windows Controls

        G 1 Reply Last reply
        0
        • C Cool_Dev

          goorley wrote:

          I would like this class to handle the click event itself.

          use ON_CONTROL_REFLECT() message map.

          BEGIN_MESSAGE_MAP(CMyBtn, CButton)
          ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
          END_MESSAGE_MAP()

          // CMyBtn derived from CButton
          void CMyBtn::OnClicked()
          {
          }

          TN062: Message Reflection for Windows Controls

          G Offline
          G Offline
          goorley
          wrote on last edited by
          #4

          Works like a charm! :thumbsup:

          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