[DUG] Order of mouse events

Max Nilson max at accredo.co.nz
Wed Jan 10 17:11:21 NZDT 2007


Keith asked:

> I want to be able to either click or drag a component without 
> using the shift key.

The only way that I have found that is satisfactory doing this sort of
thing to to use a timer to handle the mouse click. If a MouseUp event
occurs before the timer fires that you treat it as a click event, and it
the timer expires then you assume that the user has started a drag
operation (where upon you use a manual drag begin method).

Its all a bit ugly, especially if you want to support double clicks as
well, but as far as I can tell this is the only way of differentiating
between a click event and a drag start event.

Cheers, Max.



More information about the Delphi mailing list