A text entry field with a dropdown list
A <gtk-combo-box-entry>
is a widget that allows the user to choose from a
list of valid choices or enter a different value. It is very similar to a
<gtk-combo-box>
, but it displays the selected value in an entry to allow
modifying it.
In contrast to a <gtk-combo-box>
, the underlying model of a
<gtk-combo-box-entry>
must always have a text column (see
gtk-combo-box-entry-set-text-column
), and the entry will show the content
of the text column in the selected row. To get the text from the entry, use
gtk-combo-box-get-active-text
.
The changed signal will be emitted while typing into a GtkComboBoxEntry, as well
as when selecting an item from the GtkComboBoxEntry's list. Use
gtk-combo-box-get-active
or gtk-combo-box-get-active-iter
to
discover whether an item was actually selected from the list.
Connect to the activate signal of the GtkEntry (use gtk-bin-get-child
) to
detect when the user actually finishes entering text.
The convenience API to construct simple text-only <gtk-combo-box>
es can
also be used with <gtk-combo-box-entry>
s which have been constructed with
gtk-combo-box-entry-new-text
.
Derives from
<gtk-combo-box>
.This class defines the following slots:
text-column
- A column in the data source model to get the strings from
<gtk-widget>
)Creates a new
<gtk-combo-box-entry>
which has a<gtk-entry>
as child. After construction, you should set a model usinggtk-combo-box-set-model
and a text_column * usinggtk-combo-box-entry-set-text-column
.
- ret
- A new
<gtk-combo-box-entry>
.Since 2.4
<gtk-tree-model>
) (text_column int
) ⇒ (ret <gtk-widget>
)Creates a new
<gtk-combo-box-entry>
which has a<gtk-entry>
as child and a list of strings as popup. You can get the<gtk-entry>
from a<gtk-combo-box-entry>
using GTK_ENTRY (GTK_BIN (combo_box_entry)->child). To add and remove strings from the list, just modify model using its data manipulation API.
- model
- A
<gtk-tree-model>
.- text-column
- A column in model to get the strings from.
- ret
- A new
<gtk-combo-box-entry>
.Since 2.4
<gtk-widget>
)Convenience function which constructs a new editable text combo box, which is a
<gtk-combo-box-entry>
just displaying strings. If you use this function to create a text combo box, you should only manipulate its data source with the following convenience functions:gtk-combo-box-append-text
,gtk-combo-box-insert-text
,gtk-combo-box-prepend-text
andgtk-combo-box-remove-text
.
- ret
- A new text
<gtk-combo-box-entry>
.Since 2.4
<gtk-combo-box-entry>
) (text_column int
)Sets the model column which entry-box should use to get strings from to be text-column.
- entry-box
- A
<gtk-combo-box-entry>
.- text-column
- A column in model to get the strings from.
Since 2.4