Double Click on Command Button

H

Huckle

Hello,
I currently have a procedure to open a form with the "On Click" event of a
command button. I want to run another procedure on the "Double Click" event.

I can't get the Double Click event to run... at all.

My code within the "Double Click" is now simplified to just:

msgbox "This is the code inside the doubl click event"

The only thing that happens when I double click on the command button is
that the code for "On Click" runs and it seems to ignore the fact that I am
double clicking.

Thanks
Huckle
 
J

Jeanette Cunningham

Hi,
this is normal. It would be too confusing for users trying to use a single
click or a double click.

Jeanette Cunningham
 
N

Norman Yuan

I do not see the point of using double-click with a BUTTON, whih is totally
against common sense of user experiece of Windows. For a button, you expect
user to click/press it and the buttn could remain pressed until clicked
again. That is it. Why not explicitly make two buttons for each procedure,
which does not make user confused?
 
H

Huckle

Thank you for the feedback. The double click feature will be a shortcut for
advanced users. It allows them to bypass a few message boxes/prompts. I
understand this is unconventional.

Other than the fact that it doesn't typically make sense to make a
double-click event run on the double-click of a button; is there a way to
make it work?
 
D

Dirk Goldgar

Huckle said:
Thank you for the feedback. The double click feature will be a shortcut
for
advanced users. It allows them to bypass a few message boxes/prompts. I
understand this is unconventional.

Other than the fact that it doesn't typically make sense to make a
double-click event run on the double-click of a button; is there a way to
make it work?


When you double-click a command button, the Click event fires first, then
the DblClick event, and then the Click event fires again. Don't ask me why.
So if you have a MsgBox call in the Click event, that message box is going
to be displayed, and intercept your second click.

If you are determined to use both the Click and DblClick events of a command
button, and need to distinguish a single click from the first of two clicks
that make up a double-click, you have to use some tricky coding to
distinguish all the events so that you can ignore the both firings of the
Click event if they are associated with a DblClick event. The only way I
can think of to do that is to start a Timer going when the first Click
happens, use the Timer event to fire the code that would normally be part of
the (single) Click event, but turn off the timer in the DblClick event (and
set a flag then that the second firing of the Click event can test to see if
it should run or not). This is rather ugly.

If you use a label control instead of a command button, you won't get the
second firing of the Click event, but the Click event will still fire before
the DblClick event, so you have essentially the same problem. As I said,
the only way around it I can think of is to use the Timer event.
 
H

Huckle

Thank you all for the help. Is there a way to directly fire an event
procedure with a right-click (rather than a menu pop-up) or with a center
button click?
 
S

signfrom

You can use just one procedure for both click events adding a switch
inside it
for users to divert.MS invents a triple click event ? No problem.
rgds
 
D

Dirk Goldgar

Huckle said:
Thank you all for the help. Is there a way to directly fire an event
procedure with a right-click (rather than a menu pop-up) or with a center
button click?


Sorry for the delayed reply. The answer is, not that I know of.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top