Dienstag, August 28, 2007

Catching keystrokes or function keys

The last days I've been struggling to find a way to catch keystrokes in a form to create keyboard shortcuts for the users. Well, I didn't succeed so far but I found something concerning function keys.

In the shop floor control module, some forms use functions keys to control the form buttons (e.g. the form "JmgRegistraion"). I invested some time in it and it seems to me that the form doesn't really catch the keyboard event. The form uses a third party DLL and if you press F1, it will send the key "1" to the keyboard buffer. The buttons in the form have the numbers 1-9 as their first letter in the button text (property "Text" for the button).

So, you press F1, the DLL sends the key "1" to the buffer and AX then connects it to the button that starts with "1".

Well that's not really what I was looking for (and moreover, it will not work for F10, F11 and F12. It doesn't work for those keys in the mentioned form.)

But it's a start.

Kommentare:

mkavici hat gesagt…

I also needed to catch keystrokes and also didn't succeed too :)
But I have found that only tree controls catch keystrokes (keydown function) when focused. (from tetris tutorial)

Kotov Alexander hat gesagt…

Just write dll with keyboard hook. And use it on your form.

Muhammad Shujaat Siddiqi hat gesagt…

you can have keys from task method which is required to be overloaded.

Denis hat gesagt…

You should try the "SysSetupFormRun" class
it's method task() receives the keystroke code as a parameter

Hr. Denize hat gesagt…

I've also tried to catch keystrokes, e.g. ctrl-p for open projects, but I didn't make it work, so I'm following this post with the greatest interest.

Kotov Alexander hat gesagt…

Try AxAssist (http://www.axassist.com) utility.
It's provide:
- Up to 10 global managing hotkey and up to 10 hotkeys in Editor (call EditorScripts functions and etc).
- Accelerate typing with suggestion lists that appear as you type.
- And many other things.

Alexandr Malapheev hat gesagt…

There is a "task" method you can override on any form. The JmgRegistration form handling Ctrl+Q shourtcut like this