Next: , Previous: GtkComboBox, Up: Top


55 GtkComboBoxEntry

A text entry field with a dropdown list

55.1 Overview

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.

55.2 Usage

— Class: <gtk-combo-box-entry>

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
— Function: gtk-combo-box-entry-new ⇒  (ret <gtk-widget>)

Creates a new <gtk-combo-box-entry> which has a <gtk-entry> as child. After construction, you should set a model using gtk-combo-box-set-model and a text_column * using gtk-combo-box-entry-set-text-column.

ret
A new <gtk-combo-box-entry>.

Since 2.4

— Function: gtk-combo-box-entry-new-with-model (model <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

— Function: gtk-combo-box-entry-new-text ⇒  (ret <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 and gtk-combo-box-remove-text.

ret
A new text <gtk-combo-box-entry>.

Since 2.4

— Function: gtk-combo-box-entry-set-text-column (self <gtk-combo-box-entry>) (text_column int)
— Method: set-text-column

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

— Function: gtk-combo-box-entry-get-text-column (self <gtk-combo-box-entry>) ⇒  (ret int)
— Method: get-text-column

Returns the column which entry-box is using to get the strings from.

entry-box
A <gtk-combo-box-entry>.
ret
A column in the data source model of entry-box.

Since 2.4