Is there a way to avoid the OnClick call, when the user is double-clicking?
(The application is a graphical editor, where clicks change the form, and
double-clicks bring up an edit dialog. Changing the data when the user wants
to edit isn't pleasing me at the moment).
Also, undoing the change is an ackward fix which I would also like to avoid.
Jon Doran
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
********************************
Michael Glatz
glatz...@aol.com
mgl...@briefcase.com
Horrible hack but I used an isDoubleClick flag....
Alan G.
>I have an application which needs to do one task when the user single clicks
>with the mouse, and another task when they doubleclick. In my component, I
>have overridden OnClick and OnDblClick, and when I run the app I find that
>double-clicking causes both functions to be called.
>
>Is there a way to avoid the OnClick call, when the user is double-clicking?
>
>(The application is a graphical editor, where clicks change the form, and
> double-clicks bring up an edit dialog. Changing the data when the user
>wants
> to edit isn't pleasing me at the moment).
>
>Also, undoing the change is an ackward fix which I would also like to avoid.
>
Unless you wait after the OnClick for slightly longer than the system
double-click time, and then check that a double-click has not been made, you
cannot differentiate them.
As the wait for the double-click would make your application appear slow at
this point, it would be better to use the right button, or a modifier key (eg
Ctrl-Click).
Alan Lloyd
alang...@aol.com.
No. Think about it. The user clicks the mouse. Now at that moment
how can the system know whether that's a single click or the first half
of a double-click? Delphi would need to look into the future.
> (The application is a graphical editor, where clicks change the form, and
> double-clicks bring up an edit dialog. Changing the data when the user wants
> to edit isn't pleasing me at the moment).
>
> Also, undoing the change is an ackward fix which I would also like to avoid.
>
This is the way it works as you have experienced.
> (The application is a graphical editor, where clicks change the form, and
> double-clicks bring up an edit dialog. Changing the data when the user
wants
> to edit isn't pleasing me at the moment).
If you don't want to perform the OnClick if an OnDblClick follows then I
would advice you to consider to redesign your program. That will make life
easier for you and for the user.
Finn Tolderlund
Thanks to all who responded. For some reason I thought the system held mouse
click events until after the double-click time had expired. Thereby allowing
apps to distinguish the events. It looks like I was wrong there.
Given this, I'll try using the right mouse button.