136. How to have Enter move to next field in form - Part 1?

Last Updated: 20 June 2015

Hits: 14683

Problem

In php-gtk2, suppose you have set up a form. Try enter something in a field and press Enter. We would expect the cursor to move to the next field. But nothing happens! You can only move to the next field by pressing the Tab key.

Supppose you would like the Enter key to behave similar to the Tab key, that is, when you press Enter, the cursor will automatically move to the next field as shown below:

// display title
$title = new GtkLabel("Use Enter to Move to Next Field - Part 1\n"." using key-press-evnet on GtkEntry");$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));$title->set_size_request(-1, 40);$vbox->pack_start($title, 0, 0);