A form is very common in php-gtk applications. Each field usually has a label plus an entry box for user to enter inputs. We will now learn how to display such entry fields. For this example, we will start with only one field.
Until now we have only used GtkLabel and GtkButton. In this example, we will use one more widget, the GtkEntry, for data input.
Try commenting this line. You will find that without the spacer, the submit button will stick to the input field as follows:
This is how we get the user input from an entry field with the use of the method GtkEntry::get_text().
Note how the pointer to the GtkEntry $input is passed along with the signal handler. We need this to retrieve the value input by the user. We will explain this in more detail in the next Chapter on Signal Handling.