Entry widgets allow the user to enter text (surprisingly enough).
You can change the contents with the set_text()
method,
and read the current contents with the get_text()
method.
Occasionally you might want to make an Entry
widget
read-only. This can be done by passing false
to the
set_editable()
method.
For the input of passwords, passphrases and other information you don't want
echoed on the screen, calling set_visibility()
with
false
will cause the text to be hidden.
You might want to be notified whenever the user types in a text entry widget.
Gtk::Entry
provides two signals,
activate
and changed
, for just this
purpose. activate
is emitted when the user presses the
enter key in a text-entry widget; changed
is emitted when
the text in the widget changes. You can use these, for instance, to validate
or filter the text the user types.
Here is an example using Gtk::Entry
. As well as a
Gtk::Entry
widget, it has two
CheckButton
s, with which you can toggle the editable and
visible flags.