8. Text Entries

The Entry widget allows text to be typed and displayed in a single line text box. The text may be set with function calls that allow new text to replace, prepend or append the current contents of the Entry widget.

Create a new Entry widget with the following function.

$entry = Gtk2::Entry->new;

The next function alters the text which is currently within the Entry widget.

Gtk2::Entry->set_text($entry, $text);

The function Gtk2::Entry::set_text() sets the contents of the Entry widget, replacing the current contents. Note that the class Entry implements the Editable interface (yes, gobject supports Java-like interfaces) which contains more functions for manipulating the contents.

The contents of the Entry can be retrieved by using a call to the following function. This is useful in the callback functions described below.