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. Buttons

Buttons

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

    For the buttons on my dialog based application I need to have an implementation of the OnLButtonDown and OLButtonUp methods so that I know when the mouse is in different 'click' states. Looking at the available control events these aren't availble (only available for the actual dialog). Is there a way to do this? TIA, Andy

    R 1 Reply Last reply
    0
    • M mcsherry

      For the buttons on my dialog based application I need to have an implementation of the OnLButtonDown and OLButtonUp methods so that I know when the mouse is in different 'click' states. Looking at the available control events these aren't availble (only available for the actual dialog). Is there a way to do this? TIA, Andy

      R Offline
      R Offline
      Roger Broomfield
      wrote on last edited by
      #2

      Derive a class from CButton and attach it to the buttons in the dialogs OnInitDialog function (or use DDX_Control to do it in DoDataExchange but you'll have to add the DDX_Control manually outside of AFX_DATA_MAP or use the class wizard to create a member variable for the button using CButton and then move them out of AFX_DATA_MAP and modify the declaration from CButton to CMyButton if you use class wizard to derive CMyButton then class wizard actually recognizes it as a valid variable type I didnt know this), then you can add WM_LBUTTONUP/DOWN handlers to your CMyButton class. -- modified at 6:42 Monday 15th October, 2007

      M 1 Reply Last reply
      0
      • R Roger Broomfield

        Derive a class from CButton and attach it to the buttons in the dialogs OnInitDialog function (or use DDX_Control to do it in DoDataExchange but you'll have to add the DDX_Control manually outside of AFX_DATA_MAP or use the class wizard to create a member variable for the button using CButton and then move them out of AFX_DATA_MAP and modify the declaration from CButton to CMyButton if you use class wizard to derive CMyButton then class wizard actually recognizes it as a valid variable type I didnt know this), then you can add WM_LBUTTONUP/DOWN handlers to your CMyButton class. -- modified at 6:42 Monday 15th October, 2007

        M Offline
        M Offline
        mcsherry
        wrote on last edited by
        #3

        Hi, thanks for your reply, I'm having a bad start to the day so could you post a link to an article (or explain) how I can overload the CButton class? cheers,

        R D 2 Replies Last reply
        0
        • M mcsherry

          Hi, thanks for your reply, I'm having a bad start to the day so could you post a link to an article (or explain) how I can overload the CButton class? cheers,

          R Offline
          R Offline
          Roger Broomfield
          wrote on last edited by
          #4

          A simple article search for "deriving from cbutton" returned this[^] as the 1st article found

          M 1 Reply Last reply
          0
          • R Roger Broomfield

            A simple article search for "deriving from cbutton" returned this[^] as the 1st article found

            M Offline
            M Offline
            mcsherry
            wrote on last edited by
            #5

            thanks again for your help (used every word for the search apart from 'deriving'! :sigh:)

            1 Reply Last reply
            0
            • M mcsherry

              Hi, thanks for your reply, I'm having a bad start to the day so could you post a link to an article (or explain) how I can overload the CButton class? cheers,

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Use ClassWizard (Ctrl+W). In the Base class combobox, select CButton.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              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