Re: capturing keys press/realease



>i try to register a callback function this way:
>  gtk_signal_connect( GTK_OBJECT (window),
>                               "key_press_event",
>                               cb_keypress,
>                               NULL);
>  gtk_signal_connect( GTK_OBJECT (window),
>                               "key_release_event",
>                               cb_keypress,
>                               NULL);
>
>where cb_keypress is the following:
>
>void cb_keypress( GtkWidget *widget,
>                  GdkEvent  *event,
>                  gpointer   callback_data ) {

it should return int, either TRUE or FALSE. in your case, FALSE sounds
appropriate. Read the tutorial for more.

> switch(event->type) {
>  case GDK_KEY_PRESS:
>   printf("KEY PRESSED\n");
>   break;
>  case GDK_KEY_RELEASE:
>   printf("KEY RELEASED\n");
>   break;
> }
>};



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]