Solved

Timer for Single Click and Double Click

Posted on 1998-07-22
2
283 Views
Last Modified: 2013-11-20
I am making an MFC application that allows the user to draw in a system that I will analyze.  The user will use the left mouse button and right mouse button to draw the system (single click and drag).  The user will double-click with the left mouse button in order for a dialog box to pop-up for the user to enter the item's data.  My problem is when I double click with the left mouse button, the LeftMouseButtonDown function is called before the LeftMouseButtonDoublClick function.  This is causing me great pain b/c it executes code that I don't want it to.  I need some sort of timer to make the OnLeftButtonDown function wait to see if the user is double-clicking before calling that function.  Help ME!!!!
0
Comment
Question by:stchsc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1319656
You can use the GetDoubleClickTime function retrieves the current double-click time for the mouse. In your OnLButtonDown, set a one shot timer using the timeSetEvent function. In your OnLButtonDblClk, set a flag to indicate if it is a double-click. When the timer callback function is called, check the flag and do your LeftMouseButtonDown function if it is not a double-click. This is just a rough design.
0
 

Author Comment

by:stchsc
ID: 1319657
Thanks for your reply.  However, I thought of a way around it.  It is similar to what you have suggested.  Thanks for the input.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 102
Separate into files by filename 12 91
How to determine file rename from EventLog ? 2 57
Modbus - whats the maximum I can store in one register? 4 81
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question