Board index » delphi » Triggering OnDoubleClick Event without triggering OnClick Event

Triggering OnDoubleClick Event without triggering OnClick Event

I'm just wondering if there is a way to do this or not?

Thanks

Garth

   _____  ______
  /  ___\/   _  \ahlstrom
 |  /    |  |_\  \_______________
-|  |arth|  |  \  | Biology III
 |  |/~~~ \ |  /  | Comp Sci II
=|   \_/  / |_/  / TA Comp Sci I
  \______/______/======U=W=O=====-
   http://www-garth.home.ml.org  

 

Re:Triggering OnDoubleClick Event without triggering OnClick Event


Sure, use sendmessage().  

If the end-user double clicks then Windows generates a mouseclick event AND
a mousedoubleclick event.

--
Paul Motyer, SoftStuff Croydon Australia, 3136

Garth Dahlstrom <gdahl...@julian.uwo.ca> wrote in article
<Pine.SOL.3.95q.980320130126.7169A-100...@panther.uwo.ca>...

Quote

> I'm just wondering if there is a way to do this or not?
> Thanks

> Garth
>    http://www-garth.home.ml.org  

Re:Triggering OnDoubleClick Event without triggering OnClick Event


Quote
Garth Dahlstrom <gdahl...@julian.uwo.ca> writes:
>I'm just wondering if there is a way to do this or not?
>Thanks
>Garth

There's always a way. The best solution to this problem is to use a timer:
when an OnClick event is generated, start a timer (TTimer component). In
your OnDoubleClick handler, disable the timer. If the timer expires without
being disabled, then it's a single click, and you can attach code to it to
handle the single click.

One minor point to work on is the delay for the timer. There's an API function
for getting system statistics, I forget it's name, from which you can retrieve
the double click speed (the speed which Windows requires two clicks to made
within to be considered a double-click). By using that value your code will
be robust for other systems with varying double-click speeds.

--
Paul Gilbert           | p...@yallara.cs.rmit.edu.au (The DreamMaster)
Bach App Sci, Bach Eng | The opinions expressed are my own, all my own, and
Year 5, RMIT Melbourne | as such will contain no references to small {*word*141}
Australia              | creatures from Alpha Centauri.

Other Threads