Page 1 of 1

Remapping Keys, Hotkeys, How?

Posted: Wed Nov 19, 2008 2:31 pm
by mb777
Is it Possible to remap keys in PHP-GTK?

My friend wrote a clever program to remap keys to perform various functions for a game. He wrote it in visual basic.

I am learning PHP-GTK and, want to create a similar with it. Is this possible.

So far I have created a basic window with all the widgets in. I am a bit confused as tohow you capture when a user presses a key, and map it to do certain things.

Here is a link to my code so far : http://www.filefactory.com/file/f5c40a/n/01-WAHkeys_php

What I want to is for example, when the user presses the number 1 key on the normal keyboard, it will do the following:

1. Hold F1 down for the delay of F1Keydown1
2. Do nothing for a delay of F1KeyPress1
3. Hold F1 down again for a delay of F1KeyDown2
4. Do nothing for a delay of F1KeyPress3 (just realised i dont need F1Keypress2!)
5. Hold the space bar for a delay of F1KeyDown3
6. Loop these steps while the 1 key is down

Key '2' will do a similar thing with F2
Key'3' will do a similar thing with F3
etc.... up to '=' for F12

How can I capture the user keypresses and map them to these actions?
Do I need to use JAVAScript?