Capture keystrokes

  • Thread starter John... Visio MVP
  • Start date
J

John... Visio MVP

Is it possible to capture keystrokes so that I can determine what was
pressed to get to a checkbox form field? I would like to known in the entry
macro if the checkbox form field was reached by clicking with the mouse or
by pressing the arrow key or tab from the previous form field.

John... VIsio MVP
 
J

Jay Freedman

Is it possible to capture keystrokes so that I can determine what was
pressed to get to a checkbox form field? I would like to known in the entry
macro if the checkbox form field was reached by clicking with the mouse or
by pressing the arrow key or tab from the previous form field.

John... VIsio MVP

Hi John,

I suppose it's "possible", but not in the normal sense. Once you've arrived in
the form field and triggered the entry macro, that information has been lost
already. You'd have to write some add-in that hooks the keyboard and mouse
drivers, stores the last action of each along with a time stamp, and can tell
the entry macro which of the two was the latest.

What's the point of this exercise?
 
K

Karl E. Peterson

John... Visio MVP said:
Is it possible to capture keystrokes so that I can determine what was
pressed to get to a checkbox form field? I would like to known in the entry
macro if the checkbox form field was reached by clicking with the mouse or
by pressing the arrow key or tab from the previous form field.

That's an ugly one. One thought about a potential hack would be to call
GetAsyncKeyState when another control is losing focus. That'd require a lot of
tracking, but no hooking. Setting a global keyhook requires a standalone DLL, and
it's debatable the extent to which this particular type of entry point can even be
exported by ClassicVB.
 
J

John... Visio MVP

The problem is that when I tab or arrow key to a check box, the check box is
then checked and all others in the series are unchecked (the good old
mutually exclusive condition).

I have been unable to find a property that will help differentiate between
tabing to and clicking on for a check box. Everything works fine as long as
the tab and arrow kes are not touched. I was hoping to save the last
character entered in a global variable so the entry macro can check to see
what the last character was.

John...
 

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

Similar Threads


Top