Sense CTRL pressed

B

Bill

In the Access Switchboard, the OnCurrent
event gets control whenever a user moves
from one option to another. I want to sense
if the user is holding down the CTRL key
when they click on an item. I tried to
capture with a MouseDown event procedure
but the OnCurrent apparently preempts the
MouseDown event, so it never fires.

Any suggestions?

Thanks,
Bill
 
D

Dirk Goldgar

Bill said:
In the Access Switchboard, the OnCurrent
event gets control whenever a user moves
from one option to another.

Only when they move from one switchboard level to another.
I want to sense
if the user is holding down the CTRL key
when they click on an item. I tried to
capture with a MouseDown event procedure
but the OnCurrent apparently preempts the
MouseDown event, so it never fires.

Any suggestions?

You can tell at any point whether the Ctrl key is pressed, by calling the
Windows GetKeyState API function. With these declarations in, say, a
standard module:


Public Declare Function GetKeyState _
Lib "user32" _
(ByVal nVirtKey As Long) _
As Long

Public Const VK_CONTROL As Integer = &H11 ' Ctrl

.... you could put code into the switchboard's HandleButtonClick function
like this:

If GetKeyState(VK_CONTROL) < 0 Then
' The {Ctrl} key is currently pressed.
Else
' It isn't.
End If
 
B

Bill

Sounds straight forward enough. I can't get to the
actual changes until this evening or tomorrow
morning. If I don't post back by then, you can
assume everything went as suggested.
Thanks,
Bill Stanton
 
B

Bill

Worked great!!!
Thanks Dirk,
Bill Stanton



Bill said:
Sounds straight forward enough. I can't get to the
actual changes until this evening or tomorrow
morning. If I don't post back by then, you can
assume everything went as suggested.
Thanks,
Bill Stanton
 

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