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. Owner Drawn button does not get messages

Owner Drawn button does not get messages

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingquestion
3 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.
  • C Offline
    C Offline
    cpp_prgmer
    wrote on last edited by
    #1

    I have changed the properties of the existing regular button to owner-drawn. changed the button variable to custom type that's derived from CButton. In my custom type class I am handling DrawItem. But now this button stays flat and I cannot press it. While I debug I notice that I do get the DrawItem notification but when I click on the button, I am not able to draw the sunk button. Also, I cannot execute the on-btn-click event. What am I missing?

    M J 2 Replies Last reply
    0
    • C cpp_prgmer

      I have changed the properties of the existing regular button to owner-drawn. changed the button variable to custom type that's derived from CButton. In my custom type class I am handling DrawItem. But now this button stays flat and I cannot press it. While I debug I notice that I do get the DrawItem notification but when I click on the button, I am not able to draw the sunk button. Also, I cannot execute the on-btn-click event. What am I missing?

      M Offline
      M Offline
      Mohibur Rashid
      wrote on last edited by
      #2

      you should write the class detail.

      1 Reply Last reply
      0
      • C cpp_prgmer

        I have changed the properties of the existing regular button to owner-drawn. changed the button variable to custom type that's derived from CButton. In my custom type class I am handling DrawItem. But now this button stays flat and I cannot press it. While I debug I notice that I do get the DrawItem notification but when I click on the button, I am not able to draw the sunk button. Also, I cannot execute the on-btn-click event. What am I missing?

        J Offline
        J Offline
        JohnCz
        wrote on last edited by
        #3

        on-btn-click event is not an event. It is a handler for WM_COMMAND message and BN_CLICKED notification code receives as message parameter. Are you by any chance handling WM_LBUTTONDOWN or WM_LBUTTONUP? If yes, do you call base class handler? You should perform all custom drawing in DrawItem function. Is it a case?

        JohnCz

        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