Widgets can grab the keyboard focus if needed, but it only makes sense for
the ones that interact with keyboard in some way. So, GtkEntry will work, for
example, while GtkArrow will not.
<?php $entry->grab_focus(); ?>
It is possible to specify which widget should be activated when the user
presses the Enter key in a dialog box. Such a widget is called a default
one.
<?php
$ok_button->can_default(TRUE);
$ok_button->grab_default();
?>