Board index » delphi » double click/right click

double click/right click

How do I implement an event handler for a double click?  It seems that
my handler for the single click gets called first, then the handler for
the double click.  Better yet, how do I implement an event handler for a
right click?  thanks for the help

Mark Bohn

 

Re:double click/right click


Quote
> It seems that my handler for the single click gets called first,
> then the handler for the double click

Right this is the way Windows works, and you'll notice that nearly all
Windows applications are written so that a double-click performs the same
action a single-click plus something else. For example, in Windows Explorer
a single-click selects a file, while a double-click selects a file and then
executes it.

If you really need to do detect a double-click, you'll need to measure the
time between the first and second clicks and then only perform the
double-click action when this time falls beneath a threshold. You can see an
example implementation of this in the Grids unit from the VCL source.

Quote
> Better yet, how do I implement an event handler for a right click?

Use OnMouseUp, see the Button parameter.

--
Rick Rogers (TeamB)
www.componentfactory.com

Re:double click/right click


Thanks very much for the quick response.  I used the right click and it works
fine.

M. Bohn

Quote
"Rick Rogers (TeamB)" wrote:
> > It seems that my handler for the single click gets called first,
> > then the handler for the double click

> Right this is the way Windows works, and you'll notice that nearly all
> Windows applications are written so that a double-click performs the same
> action a single-click plus something else. For example, in Windows Explorer
> a single-click selects a file, while a double-click selects a file and then
> executes it.

> If you really need to do detect a double-click, you'll need to measure the
> time between the first and second clicks and then only perform the
> double-click action when this time falls beneath a threshold. You can see an
> example implementation of this in the Grids unit from the VCL source.

> > Better yet, how do I implement an event handler for a right click?

> Use OnMouseUp, see the Button parameter.

> --
> Rick Rogers (TeamB)
> www.componentfactory.com

Re:double click/right click


Quote
> Thanks very much

You're welcome. As a side note, remember to trim your quoting as per the
published newsgroup guidelines
(http://www.borland.com/newsgroups/guide.html). You quoted my entire message
to add a short reply. This isn't necessary in threaded newsgroups. Cheers.

--
Rick Rogers (TeamB)
www.componentfactory.com

Other Threads