I am not sure if you totally understood the concept of assigning events to keys. Ok, the first thing you do is writing a function that is to be executed. Like this:
void my_key_event()
{
printf("my_key_event was called");
}
Note that this function is not called until now. In order to assign it to a certain key you have to do the following:
That's all. There is nothing more to do. You can get rid of the key assignment by simply writing:
If that does not work for you there is another place in your code where on_1 gets changed as well. You can easily check this by doing the following:
on_1 = NULL;
wait(1);
if (on_1)
printf("Oh crap! on_1 got reassigned some place else!")
Here you have a running example:
#include <acknex.h>
void foobar()
{
beep();
}
void main()
{
on_1 = foobar;
wait(-10);
on_1 = NULL;
}
In the example a key press of 1 will beep for the first ten seconds. After that the key will get disabled.