key-press-event

This is an event signal, fired when the connected widget picks up a GDK_KEY_PRESS event. Key press events are generated by any of the keys on a keyboard being pressed. You can distinguish between the key values in the callback using an if or switch statement:

<?php
function on_click($widget, $event, $data)
{
    if($event->keyval==GDK_KEY_Return) {
        /*do something appropriate for the return key being pressed*/
    } elseif($event->keyval > GDK_KEY__a) {
        /*we can reach the character strings, too*/
        echo $event->string."\n";
    }
}
?>

Yes, we have hard-coded keysyms. The full list of PHP-GTK keysymbol constants is in the source code in the file php-gtk/ext/gtk+/php_gdk.c.

Callback function

bool callback(GtkWidget widget, GdkEvent key_press);