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. mouse event

mouse event

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.
  • A Offline
    A Offline
    andyg 101
    wrote on last edited by
    #1

    How can I tell wether a button control is being held down or not? I can't seem to use the flag from WM_LBUTTONDOWN because I don't have the same flag parameter passed into my button handler Any ideas? Andy

    K 1 Reply Last reply
    0
    • A andyg 101

      How can I tell wether a button control is being held down or not? I can't seem to use the flag from WM_LBUTTONDOWN because I don't have the same flag parameter passed into my button handler Any ideas? Andy

      K Offline
      K Offline
      Keith D
      wrote on last edited by
      #2

      It's being held down until you get a WM_LBUTTONUP message.

      A 1 Reply Last reply
      0
      • K Keith D

        It's being held down until you get a WM_LBUTTONUP message.

        A Offline
        A Offline
        andyg 101
        wrote on last edited by
        #3

        hmm tried what you said, what I really want is this, and I couldn't get it to work. I want to execute one bit of code when the button is pressed and then another when it is released. How can I do that? Andy

        C 1 Reply Last reply
        0
        • A andyg 101

          hmm tried what you said, what I really want is this, and I couldn't get it to work. I want to execute one bit of code when the button is pressed and then another when it is released. How can I do that? Andy

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          Just a suggestion: you can perhaps subclass your own button class (derived from CButton) and add handlers for the WM_LBUTTONDOWN and the WM_LBUTTONUP messages. In these functions, send a notification message to the parent. Hope this helps

          A 1 Reply Last reply
          0
          • C Cedric Moonen

            Just a suggestion: you can perhaps subclass your own button class (derived from CButton) and add handlers for the WM_LBUTTONDOWN and the WM_LBUTTONUP messages. In these functions, send a notification message to the parent. Hope this helps

            A Offline
            A Offline
            andyg 101
            wrote on last edited by
            #5

            is there any way to detect that a particular button is being held down. i.e. on the WM_LBUTTONDOWN message, how can I check wether a particular button is pressed in a similar way to say a checkbox? Andy ps what notification message do you mean?

            C 1 Reply Last reply
            0
            • A andyg 101

              is there any way to detect that a particular button is being held down. i.e. on the WM_LBUTTONDOWN message, how can I check wether a particular button is pressed in a similar way to say a checkbox? Andy ps what notification message do you mean?

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              Another suggsetion is to add handlers for the WM_LBUTTONDOWN and WM_LBUTTONUP messages in your dialog (or view) class. In these functions, test if the position (the point parameter) is on the button. For this you can use CWnd::ChildWindowFromPoint (take a look at the documentation) and then call GetDlgCtrlID for the CWnd that is returned to see if this is your button. You can also use flags to keep trace if the button is pressed or not. Hope this helps

              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