Triggering OnDblClick without triggering OnClick

Posted on 2005-03-17
Medium Priority
Last Modified: 2010-04-05
basically that's it, I want to Trigger the OnDblClick event without triggering the OnClick event first. This on a TCustomControl descendant. does anyone know how to do it?

Thank you.
Question by:Dissaster
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
LVL 27

Assisted Solution

BigRat earned 186 total points
ID: 13567129
These events are related to the windows messages and windows always sends a click before the double click. The only way I could see you doing this is to take over the windows message handlers for left button down, left button up and the left double click and ONLY call inherited (which causes the events to occur)  when you are certain that the message is really a click.

 Double-clicking the left mouse button actually generates a sequence of four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP.
You'd need to delay the Click event waiting for the double click. Not very easy I'm afraid.
LVL 19

Accepted Solution

Barthax earned 189 total points
ID: 13567158
Programmatically, you can simply call the OnDblClick event from elsewhere.  However, if I guess correctly you want the user to perform some double-clicking with the mouse which does not fire the OnClick?  Normally, this is not possible within the form framework - purely because Windows sends a series of WM_xBUTTONx events before Windows resolves it to a WM_xBUTTONDBLCLK event.  See http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/aboutmouseinput.asp for the MSDN overview of event structures.  To get around the whole scenario you would have to trap and program the events for each of the events prior to the DBLCLK event and figure out your own way of resolving what it is you need...

Alternatively, you could move your code from the OnClick event to a timer and start the timer in the OnClick and stop the timer int he OnDblClick to prevent it from firing.
LVL 17

Expert Comment

ID: 13567213
You can assign Onclick := nil ?

Author Comment

ID: 13567715
I can not assign onclick := nil, because i want two different actions to be done on click an ondblclick

so basically this is a windows limitation, well, I'll see if i can find a workaround to do this, thanks..

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 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