On Dbl Click event

  • Thread starter Thread starter FPS, Romney
  • Start date Start date
F

FPS, Romney

Hi all,
In Access 97, SR2, the On Dbl Click event for forms produces the same result
as the On Click event. Why is this?

.... I've had to watch where I place buttons which open other forms because
accidental double-clicks on the first form can produce unintentional
"clicks" on the second form as it opens.

Thanks,
Mark
 
Actually, if you have a click event it will always be implemented and
any double click event will probably never be implemented.

You might try using only double click events - move your click event
code to the double click event - but that is counter to the normal
interface.

I guess you could open the other forms with all the controls locked and
have a timer event run after 500 milliseconds that would unlock all the
controls and set the timer interval to zero (so the event would not be
continually running).

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
in message
Hi all,
In Access 97, SR2, the On Dbl Click event for forms produces the same
result
as the On Click event. Why is this?

I'm not sure what you mean, but double-clicking a control causes both the
Click and DblClick events to fire. If the control is a command button, the
Click event then fires a *second* time, after the DblClick event. This is
all, as they say, "by design", and documented in the help file. This makes
it difficult to use both the Click and the DblClick event of a control, and
I make it a policy not to do that.
... I've had to watch where I place buttons which open other forms because
accidental double-clicks on the first form can produce unintentional
"clicks" on the second form as it opens.

I can see how that could be an issue, if you or your users are habitual
double-clickers, though I haven't run into it myself.
 
On my switchboard I have a left side panel that contains "buttons" for
opening various standard forms. These aren't command buttons, but instead
image files with events on the double click procedures of the image (two
images for each "button" - the normal and the active with a yellow orangish
tinge which is easily enough accomplished via a decent image editor).

This works nice because is keeps the users from accidentally opening a form
(single clicks are pretty easy to accidentally land anywhere, especially when
trying to bring the buried switchboard form to the top), and you can get some
fancy graphics for your "buttons".

This may be of some consideration if you would like to make sure users
aren't accidentally running commands (I don't go so far as to get the
depression effect of a clicked button on my images, but playing around with
some graphics and maybe even the onmouseover event you could probably
simulate the effect fairly accurately).

Bottom line, if you don't want a double click rather than click, don't use a
command button. If you want just one click, use a command button.

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
On some Operating System, you have the possibility to have the single click
to behave as a double click (to help people having fine motricity problem).
Maybe that setting is set, if you find that the system seems to over-react
as if you did two single-clicks when your intention is to use a single
double-click.

Can be something else, though. It is just one among multiple possibilities.


Vandergahst, Access MVP
 
Thanks all for the responses.
I've moved the buttons on one of the second forms out of the way in case of
dbl-clicks.
On another form, however, is a fairly large calendar and darn if that second
click doesn't land right on the part of the calendar that advances to the
next month. I guess I'll just let people learn not to dbl-click when they go
to open this form from the main switchboard.
Thanks again,
Mark
 
Thanks, Jim ... I tried that but it makes no difference: if I dbl-click the
command button the second form opens and then the second click gets applied
to the position of the cursor.

I tried having the On Click event of the command button open the second form
(as is normal) and then placed a msgbox in the On Dbl Click event of that
same button. When I double click the button, the second form opens, but the
message never displays.
 
Thanks, Jim.
I'm having trouble understanding the flow of events in your suggestion, but
I'll work on it. The problem doesn't occur that often -- most users learn to
be careful with their clicks. Laptops with sensitive touch pads seem most
prone to this kind of problem, but they're more prone to inadvertent clicks,
even single clicks, anyway.

It does seem that Access will simply ignore the Dbl Click event if there's
also a Single Click event for that command button AND the Single Click event
involves opening a form -- even just a msgbox.

If the Single Click event involves setting the value of Textbox-1 and the
Dbl Click event involves setting the value of Textbox-2, then
single-clicking the command button results in the setting of Textbox-1 (as
intended). Double-clicking, however, results in not only setting the value
of Textbox-2 (with its dbl-click value), but also setting the value of
Textbox-1 with its single-click value.

Mark

JimBurke via AccessMonster.com said:
Oh well, worth a try anyway. Seems kind of odd that they'll let you do one or
the other, but not both. Other applications can obviously handle it, not sure
why Access can't. Maybe there's a way to detect that a click was done when
you open the form and ignore it?

One thing you could do, if this is a real pain for your users. If you're
willing to have the very first click of the 'offending' button ignored in the
cases where your user didn't double click form the previous form, you could
set a module-level boolean variable in the form that opens up in it's open
event, say it's called firstClick. Set it to true there. Then on the button's
On Click event, put this at the very beginning:

If firstClick then
firstClick = false
exit sub
end if


Thanks, Jim ... I tried that but it makes no difference: if I dbl-click the
command button the second form opens and then the second click gets applied
to the position of the cursor.

I tried having the On Click event of the command button open the second form
(as is normal) and then placed a msgbox in the On Dbl Click event of that
same button. When I double click the button, the second form opens, but the
message never displays.
If you're having trouble with certain buttons, I think you can just duplicate
the on Click code in the On Double Click event proc - I think that way
it
[quoted text clipped - 14 lines]
Thanks,
Mark
 
Yes, I see what's happening now. Thank you, Jim, for the suggestion and the
clarification.
Mark

JimBurke via AccessMonster.com said:
Just to clarify my crazy suggestion:

1) at the top of the code module of the form that is opened when the button
is clicked:

Dim firstClick as Boolean

2) in that same form's Open event proc:

firstClick = True

3) again on that form, in the event proc of the control that sometimes gets
activated by the double-click:

If firstClick then
firstClick = false
exit sub
end if

Put that at the very beginning of the control's click event proc. this way
the very first time that on click event is triggered it will be ignored. If
it's triggered by the double-click from the previous menu, then the variable
is reset, nothing happens, and the first click on the control by the user
will work fine. If it wasn't triggered by a double-click from the previous
menu, then the user will just think the click didn't take and they'll have to
click a 2nd time. after that the variable is set to false and it's ignored as
long as the form remains open.
Thanks, Jim.
I'm having trouble understanding the flow of events in your suggestion, but
I'll work on it. The problem doesn't occur that often -- most users learn to
be careful with their clicks. Laptops with sensitive touch pads seem most
prone to this kind of problem, but they're more prone to inadvertent clicks,
even single clicks, anyway.

It does seem that Access will simply ignore the Dbl Click event if there's
also a Single Click event for that command button AND the Single Click event
involves opening a form -- even just a msgbox.

If the Single Click event involves setting the value of Textbox-1 and the
Dbl Click event involves setting the value of Textbox-2, then
single-clicking the command button results in the setting of Textbox-1 (as
intended). Double-clicking, however, results in not only setting the value
of Textbox-2 (with its dbl-click value), but also setting the value of
Textbox-1 with its single-click value.

Mark
Oh well, worth a try anyway. Seems kind of odd that they'll let you do one or
the other, but not both. Other applications can obviously handle it,
not sure
[quoted text clipped - 27 lines]
Thanks,
Mark
 
Back
Top