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. Click and Double-click problem

Click and Double-click problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpmobilequestion
2 Posts 2 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.
  • R Offline
    R Offline
    Rostfrei
    wrote on last edited by
    #1

    Hello! I'm sure you guys with tons of experience had same dilemma some time in your carrier. I got in my mind almost impossible task to implement from my project manager. I have to implement click and double click on the same button control. The idea is that single-click would do some action A and double click would do action B that is totally unrelated to action A. At first look it seems ok, but windows manifest double-click like single-click followed by double-click event. So how would I know that single-click will be followed by double-click event and not do anything on the first event but just the second one and execute just action B? In my mind there is no solution to this problem except delaying the single-click event for the time in which double-click may happen. This can result that clients would complain that single-click is slow responsive. Please help me or direct me to some resources so I can convince myself or my project manager that there is or is not the solution for the given problem. Best regards,

    Rostfrei

    M 1 Reply Last reply
    0
    • R Rostfrei

      Hello! I'm sure you guys with tons of experience had same dilemma some time in your carrier. I got in my mind almost impossible task to implement from my project manager. I have to implement click and double click on the same button control. The idea is that single-click would do some action A and double click would do action B that is totally unrelated to action A. At first look it seems ok, but windows manifest double-click like single-click followed by double-click event. So how would I know that single-click will be followed by double-click event and not do anything on the first event but just the second one and execute just action B? In my mind there is no solution to this problem except delaying the single-click event for the time in which double-click may happen. This can result that clients would complain that single-click is slow responsive. Please help me or direct me to some resources so I can convince myself or my project manager that there is or is not the solution for the given problem. Best regards,

      Rostfrei

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      When you get the first WM_LBUTTONDOWN, start a timer whose timeout value is at least GetDoubleClickTime(). If the timer expires before you get WM_LBUTTONDBLCLK, then do your single-click action.

      Rostfrei wrote:

      This can result that clients would complain that single-click is slow responsive.

      Bill them for the time spent researching time travel so your code can see into the future to determine whether the user is going to double-click. ;)

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

      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