Triggering OnDblClick without triggering OnClick

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.
LVL 1
DissasterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BigRatCommented:
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.
0
BarthaxCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mokuleCommented:
You can assign Onclick := nil ?
mokule
0
DissasterAuthor Commented:
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..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.